1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132: 133: 134: 135: 136: 137: 138: 139: 140: 141: 142: 143: 144: 145: 146: 147: 148: 149: 150: 151: 152: 153: 154: 155: 156: 157: 158: 159: 160: 161: 162: 163: 164: 165: 166: 167: 168: 169: 170: 171: 172: 173: 174: 175: 176: 177: 178: 179: 180: 181: 182: 183: 184: 185: 186: 187: 188: 189: 190: 191: 192: 193: 194: 195: 196: 197: 198: 199: 200: 201: 202: 203: 204: 205: 206: 207: 208: 209: 210:
<?php
/**
*Comment Class
* @package plugins
* @subpackage comment-form
*/
// force UTF-8 Ø
class Comment extends PersistentObject {
var $comment_error_text = NULL;
var $dataconfirmation = null;
/**
* This is a simple class so that we have a convienient "handle" for manipulating comments.
*
* @return Comment
*/
/**
* Constructor for a comment
*
* @param int $id set to the ID of the comment if not a new one.
* @return Comment
*/
function __construct($id=NULL) {
$new = $this->instantiate('comments', array('id'=>$id), 'id', true, is_null($id));
}
/**
* Sets up default items on new comment objects
*
*/
function setDefaults() {
$this->set('date', date('Y-m-d H:i:s'));
}
// convienence get & set functions
/**
* returns the comment date/time
*
* @return string
*/
function getDateTime() { return $this->get('date'); }
/**
* Sets a comment date/time value
*
* @param string $datetime
*/
function setDateTime($datetime) {
if ($datetime == "") {
$this->set('date', '0000-00-00 00:00:00');
} else {
$newtime = dateTimeConvert($datetime);
if ($newtime === false) return;
$this->set('date', $newtime);
}
}
/**
* Returns the id of the comment owner
*
* @return int
*/
function getOwnerID() { return $this->get('ownerid'); }
/**
* Sets the id of the owner of the comment
*
* @param int $value
*/
function setOwnerID($value) { $this->set('ownerid', $value); }
/**
* Returns the commentor's name
*
* @return string
*/
function getName() { return $this->get('name'); }
/**
* Sets the commentor's name
*
* @param string $value
*/
function setName($value) { $this->set('name', $value); }
/**
* returns the email address of the commentor
*
* @return string
*/
function getEmail() { return $this->get('email'); }
/**
* Sets the email address of the commentor
*
* @param string $value
*/
function setEmail($value) { $this->set('email', $value); }
/**
* returns the Website of the commentor
*
* @return string
*/
function getWebsite() { return $this->get('website'); }
/**
* Stores the website of the commentor
*
* @param string $value
*/
function setWebsite($value) { $this->set('website', $value); }
/**
* Returns the comment text
*
* @return string
*/
function getComment() { return $this->get('comment'); }
/**
* Stores the comment text
*
* @param string $value
*/
function setComment($value) { $this->set('comment', $value); }
/**
* Returns true if the comment is marked for moderation
*
* @return int
*/
function getInModeration() { return $this->get('inmoderation'); }
/**
* Sets the moderation flag of the comment
*
* @param int $value
*/
function setInModeration($value) { $this->set('inmoderation', $value); }
/**
* Returns the 'type' of the comment. i.e. the class of the owner object
*
* @return string
*/
function getType() {
return $this->get('type');
}
/**
* Sets the 'type' field of the comment
*
* @param string $type
*/
function setType($type) {
$this->set('type', $type);
}
/**
* Returns the IP address of the comment poster
*
* @return string
*/
function getIP() { return $this->get('ip'); }
/**
* Sets the IP address field of the comment
*
* @param string $value
*/
function setIP($value) { $this->set('ip', $value); }
/**
* Returns true if the comment is flagged private
*
* @return bool
*/
function getPrivate() { return $this->get('private'); }
/**
* Sets the private flag of the comment
*
* @param bool $value
*/
function setPrivate($value) { $this->set('private', $value); }
/**
* Returns true if the comment is flagged anonymous
*
* @return bool
*/
function getAnon() { return $this->get('anon'); }
/**
* Sets the anonymous flag of the comment
*
* @param bool $value
*/
function setAnon($value) { $this->set('anon', $value); }
/**
* Returns the custom data field of the comment
*
* @return string
*/
function getCustomData() { return $this->get('custom_data'); }
/**
* Stores the custom data field of the comment
*
* @param string $value
*/
function setCustomData($value) { $this->set('custom_data', $value); }
}
?>