コード例 #1
0
 public function load_fields_from_array($data)
 {
     if (is_array($data)) {
         for ($a = 0; $a < count($data); $a++) {
             $r = $data[$a];
             if (is_array($r) && isset($r['value']) && isset($r['field_id']) && isset($r['comment_id']) && $r['comment_id'] == $this->id) {
                 $v = $r['value'];
                 if (cgfb_comment_ops::get_fielddef_type($r['field_id']) == 4) {
                     $v = explode(',', $v);
                 }
                 $this->set_field_by_id($r['field_id'], $v);
             }
         }
     }
 }
コード例 #2
0
    $this->SetError($this->Lang('error_missingparam'));
    $this->RedirectToTab($id);
}
$cid = (int) $params['cid'];
$spamcheck_module_name = $this->GetPreference('spamcheck_module', -1);
if ($spamcheck_module_name != -1) {
    $spamcheck_module =& $this->GetModuleInstance($spamcheck_module_name);
    if (is_object($spamcheck_module)) {
        $spamcheck_enabled = 1;
    }
}
#
# Get the data
#
$comment = cgfb_comment_ops::load($cid);
$tfields = cgfb_comment_ops::get_fielddefs();
foreach ($tfields as $fid => &$tfield) {
    $tfield['value'] = $comment->get_field_by_id($tfield['id']);
    switch ($tfield['type']) {
        case 2:
            $tfield['input'] = $this->CreateTextArea(isset($tfield['attribs']['usewysiwyg']) && $tfield['attribs']['usewysiwyg'] == 1 && $this->GetPreference('allow_comment_wysiwyg', 0), $id, $tfield['value'], 'field_' . $tfield['id']);
            break;
    }
}
$orig_status = $comment->status;
#
# Process form data
#
if (isset($params['cancel'])) {
    $this->RedirectToTab($id);
} else {
コード例 #3
0
}
$ops = $this->GetCommentOperations();
if (!is_object($ops)) {
    return;
}
$count = 0;
foreach ($selected as $one) {
    switch ($params['bulk_action']) {
        case 'delete':
            $ret = $ops->delete_comment($one);
            if ($ret == TRUE) {
                $count++;
            }
            break;
        case 'published':
            $comment = cgfb_comment_ops::load($one);
            $ret = $ops->change_comment_status($one, CGFEEDBACK_STATUS_PUBLISHED);
            if ($ret == TRUE) {
                if ($comment->status != CGFEEDBACK_STATUS_PUBLISHED) {
                    // previous status was not published, so we can notify users.
                    cgfb_comment_notifier::notify_users($comment);
                }
                $count++;
            }
            break;
        case 'draft':
            $ret = $ops->change_comment_status($one, CGFEEDBACK_STATUS_DRAFT);
            if ($ret == TRUE) {
                $count++;
            }
            break;