1: <?php
2: 3: 4: 5: 6: 7: 8: 9:
10:
11: if (!defined('XOOPS_ROOT_PATH')) exit();
12:
13: require_once XOOPS_ROOT_PATH . "/core/XCube_ActionForm.class.php";
14:
15: class Legacy_CommentEditForm extends XCube_ActionForm
16: {
17: function getTokenName()
18: {
19: return "module.legacy.Legacy_CommentEditForm.TOKEN";
20: }
21:
22: function prepare()
23: {
24:
25:
26:
27: $this->mFormProperties['com_id'] =new XCube_IntProperty('com_id');
28: $this->mFormProperties['com_pid'] =new XCube_IntProperty('com_pid');
29: $this->mFormProperties['com_rootid'] =new XCube_IntProperty('com_rootid');
30: $this->mFormProperties['com_modid'] =new XCube_IntProperty('com_modid');
31: $this->mFormProperties['com_itemid'] =new XCube_IntProperty('com_itemid');
32: $this->mFormProperties['com_icon'] =new XCube_StringProperty('com_icon');
33: $this->mFormProperties['com_created'] =new XCube_IntProperty('com_created');
34: $this->mFormProperties['com_modified'] =new XCube_IntProperty('com_modified');
35: $this->mFormProperties['com_ip'] =new XCube_StringProperty('com_ip');
36: $this->mFormProperties['com_title'] =new XCube_StringProperty('com_title');
37: $this->mFormProperties['com_text'] =new XCube_TextProperty('com_text');
38: $this->mFormProperties['com_sig'] =new XCube_BoolProperty('com_sig');
39: $this->mFormProperties['com_status'] =new XCube_IntProperty('com_status');
40: $this->mFormProperties['com_exparams'] =new XCube_StringProperty('com_exparams');
41: $this->mFormProperties['dosmiley'] =new XCube_BoolProperty('dosmiley');
42: $this->mFormProperties['doxcode'] =new XCube_BoolProperty('doxcode');
43: $this->mFormProperties['doimage'] =new XCube_BoolProperty('doimage');
44: $this->mFormProperties['dobr'] =new XCube_BoolProperty('dobr');
45:
46:
47:
48:
49: $this->mFieldProperties['com_id'] =new XCube_FieldProperty($this);
50: $this->mFieldProperties['com_id']->setDependsByArray(array('required'));
51: $this->mFieldProperties['com_id']->addMessage('required', _MD_LEGACY_ERROR_REQUIRED, _MD_LEGACY_LANG_COM_ID);
52:
53: $this->mFieldProperties['com_pid'] =new XCube_FieldProperty($this);
54: $this->mFieldProperties['com_pid']->setDependsByArray(array('required'));
55: $this->mFieldProperties['com_pid']->addMessage('required', _MD_LEGACY_ERROR_REQUIRED, _MD_LEGACY_LANG_COM_PID);
56:
57: $this->mFieldProperties['com_rootid'] =new XCube_FieldProperty($this);
58: $this->mFieldProperties['com_rootid']->setDependsByArray(array('required'));
59: $this->mFieldProperties['com_rootid']->addMessage('required', _MD_LEGACY_ERROR_REQUIRED, _MD_LEGACY_LANG_COM_ROOTID);
60:
61: $this->mFieldProperties['com_modid'] =new XCube_FieldProperty($this);
62: $this->mFieldProperties['com_modid']->setDependsByArray(array('required'));
63: $this->mFieldProperties['com_modid']->addMessage('required', _MD_LEGACY_ERROR_REQUIRED, _MD_LEGACY_LANG_COM_MODID);
64:
65: $this->mFieldProperties['com_itemid'] =new XCube_FieldProperty($this);
66: $this->mFieldProperties['com_itemid']->setDependsByArray(array('required'));
67: $this->mFieldProperties['com_itemid']->addMessage('required', _MD_LEGACY_ERROR_REQUIRED, _MD_LEGACY_LANG_COM_ITEMID);
68:
69: $this->mFieldProperties['com_icon'] =new XCube_FieldProperty($this);
70: $this->mFieldProperties['com_icon']->setDependsByArray(array('required','maxlength'));
71: $this->mFieldProperties['com_icon']->addMessage('required', _MD_LEGACY_ERROR_REQUIRED, _MD_LEGACY_LANG_COM_ICON, '25');
72: $this->mFieldProperties['com_icon']->addMessage('maxlength', _MD_LEGACY_ERROR_MAXLENGTH, _MD_LEGACY_LANG_COM_ICON, '25');
73: $this->mFieldProperties['com_icon']->addVar('maxlength', 25);
74:
75: $this->mFieldProperties['com_ip'] =new XCube_FieldProperty($this);
76: $this->mFieldProperties['com_ip']->setDependsByArray(array('required','maxlength'));
77: $this->mFieldProperties['com_ip']->addMessage('required', _MD_LEGACY_ERROR_REQUIRED, _MD_LEGACY_LANG_COM_IP, '15');
78: $this->mFieldProperties['com_ip']->addMessage('maxlength', _MD_LEGACY_ERROR_MAXLENGTH, _MD_LEGACY_LANG_COM_IP, '15');
79: $this->mFieldProperties['com_ip']->addVar('maxlength', 15);
80:
81: $this->mFieldProperties['com_title'] =new XCube_FieldProperty($this);
82: $this->mFieldProperties['com_title']->setDependsByArray(array('required','maxlength'));
83: $this->mFieldProperties['com_title']->addMessage('required', _MD_LEGACY_ERROR_REQUIRED, _MD_LEGACY_LANG_COM_TITLE, '255');
84: $this->mFieldProperties['com_title']->addMessage('maxlength', _MD_LEGACY_ERROR_MAXLENGTH, _MD_LEGACY_LANG_COM_TITLE, '255');
85: $this->mFieldProperties['com_title']->addVar('maxlength', 255);
86:
87: $this->mFieldProperties['com_text'] =new XCube_FieldProperty($this);
88: $this->mFieldProperties['com_text']->setDependsByArray(array('required'));
89: $this->mFieldProperties['com_text']->addMessage('required', _MD_LEGACY_ERROR_REQUIRED, _MD_LEGACY_LANG_COM_TEXT);
90:
91: $this->mFieldProperties['com_exparams'] =new XCube_FieldProperty($this);
92: $this->mFieldProperties['com_exparams']->setDependsByArray(array('required','maxlength'));
93: $this->mFieldProperties['com_exparams']->addMessage('required', _MD_LEGACY_ERROR_REQUIRED, _MD_LEGACY_LANG_COM_EXPARAMS, '255');
94: $this->mFieldProperties['com_exparams']->addMessage('maxlength', _MD_LEGACY_ERROR_MAXLENGTH, _MD_LEGACY_LANG_COM_EXPARAMS, '255');
95: $this->mFieldProperties['com_exparams']->addVar('maxlength', 255);
96: }
97:
98: function load(&$obj)
99: {
100: $this->set('com_id', $obj->get('com_id'));
101: $this->set('com_pid', $obj->get('com_pid'));
102: $this->set('com_rootid', $obj->get('com_rootid'));
103: $this->set('com_modid', $obj->get('com_modid'));
104: $this->set('com_itemid', $obj->get('com_itemid'));
105: $this->set('com_icon', $obj->get('com_icon'));
106: $this->set('com_created', $obj->get('com_created'));
107: $this->set('com_modified', $obj->get('com_modified'));
108: $this->set('com_ip', $obj->get('com_ip'));
109: $this->set('com_title', $obj->get('com_title'));
110: $this->set('com_text', $obj->get('com_text'));
111: $this->set('com_sig', $obj->get('com_sig'));
112: $this->set('com_status', $obj->get('com_status'));
113: $this->set('com_exparams', $obj->get('com_exparams'));
114: $this->set('dosmiley', $obj->get('dosmiley'));
115: $this->set('doxcode', $obj->get('doxcode'));
116: $this->set('doimage', $obj->get('doimage'));
117: $this->set('dobr', $obj->get('dobr'));
118: }
119:
120: function update(&$obj)
121: {
122: $obj->set('com_id', $this->get('com_id'));
123: $obj->set('com_pid', $this->get('com_pid'));
124: $obj->set('com_rootid', $this->get('com_rootid'));
125: $obj->set('com_modid', $this->get('com_modid'));
126: $obj->set('com_itemid', $this->get('com_itemid'));
127: $obj->set('com_icon', $this->get('com_icon'));
128: $obj->set('com_created', $this->get('com_created'));
129: $obj->set('com_modified', time());
130:
131:
132:
133:
134:
135:
136:
137:
138:
139: $obj->set('com_ip', $_SERVER['REMOTE_ADDR']);
140: $obj->set('com_title', $this->get('com_title'));
141: $obj->set('com_text', $this->get('com_text'));
142: $obj->set('com_sig', $this->get('com_sig'));
143: $obj->set('com_status', $this->get('com_status'));
144: $obj->set('com_exparams', $this->get('com_exparams'));
145: $obj->set('dosmiley', $this->get('dosmiley'));
146: $obj->set('doxcode', $this->get('doxcode'));
147: $obj->set('doimage', $this->get('doimage'));
148: $obj->set('dobr', $this->get('dobr'));
149: }
150: }
151:
152: class Legacy_CommentEditForm_Admin extends Legacy_CommentEditForm
153: {
154: function prepare()
155: {
156: parent::prepare();
157:
158:
159:
160:
161: $this->mFormProperties['dohtml'] =new XCube_BoolProperty('dohtml');
162: }
163:
164: function load(&$obj)
165: {
166: parent::load($obj);
167:
168: $this->set('dohtml', $obj->get('dohtml'));
169: }
170:
171: function update(&$obj)
172: {
173: update::load($obj);
174:
175: $obj->set('dohtml', $this->get('dohtml'));
176: }
177: }
178:
179: ?>
180: