} ##Update the custom fields $sql = "SELECT * FROM `tbl_entries2customfields` WHERE `entry_id` = '" . $e['id'] . "'"; $customfields = $DB->fetch($sql); if (!$error && is_array($customfields) && !empty($customfields)) { foreach ($customfields as $c) { $fields = array(); $format = $DB->fetchVar("format", 0, "SELECT `format` FROM `tbl_customfields` WHERE `id` = '" . $c['field_id'] . "' LIMIT 1"); if ($format == '1' && $e['formatter'] && !@is_object($formatter)) { $error = true; $Admin->log->pushToLog("Failed (Could not create formatter '" . $e['formatter'] . "')", SYM_LOG_NOTICE, true, true, true); } else { if (!@is_object($formatter)) { $fields['value'] = $formatter->run(General::reverse_sanitize($c['value_raw'])); } else { $fields['value'] = General::reverse_sanitize($c['value_raw']); } } ##Update the entry if (!$DB->update($fields, "tbl_entries2customfields", "WHERE `field_id` = '" . $c['field_id'] . "' AND `entry_id` = '" . $e['id'] . "' LIMIT 1")) { $Admin->log->pushToLog("Failed (Problem updating custom fields)", SYM_LOG_NOTICE, true, true, true); $error = true; } } } } if (!$error) { $Admin->log->pushToLog("Done.", SYM_LOG_NOTICE, true, true, true); } } }
/** * Give the field some data and ask it to return a value using one of many * possible modes. * * @param mixed $data * @param integer $mode * @param integer $entry_id * @return array|null */ public function prepareExportValue($data, $mode, $entry_id = null) { $modes = (object) $this->getExportModes(); if (isset($data['relation_id']) === false) { return null; } if (is_array($data['relation_id']) === false) { $data['relation_id'] = array($data['relation_id']); } if ($mode === $modes->getPostdata) { // Return postdata: return $data; } else { if ($mode === $modes->listEntry) { // Return the entry IDs: return $data['relation_id']; } else { if ($mode === $modes->listEntryObject) { // Return entry objects: $items = array(); $entries = EntryManager::fetch($data['relation_id']); foreach ($entries as $entry) { if (is_array($entry) === false || empty($entry)) { continue; } $items[] = current($entry); } return $items; } } } // All other modes require full data: $data = $this->findRelatedValues($data['relation_id']); $items = array(); foreach ($data as $item) { $item = (object) $item; if ($mode === $modes->listValue) { $items[] = General::reverse_sanitize($item->value); } elseif ($mode === $modes->listEntryToValue) { $items[$item->id] = General::reverse_sanitize($item->value); } } return $items; }
<td colspan="3" class="inactive"> None found. </td> </tr> <?php } else { $bEven = false; $date = $Admin->getDateObj(); foreach ($comments as $comment) { foreach ($comment as $index => $value) { $comment[$index] = htmlspecialchars(stripslashes($value)); } $url = $Admin->getCurrentPageURL() . 'edit/&id=' . $comment['id']; extract($comment, EXTR_PREFIX_ALL, "comment"); $comment_creation_timestamp_gmt = $DB->fetchVar("creation_timestamp_gmt", 0, "SELECT UNIX_TIMESTAMP(creation_date_gmt) as `creation_timestamp_gmt` FROM `tbl_metadata` WHERE `relation_id` = '{$comment_id}' AND `class` = 'comment' LIMIT 1"); $comment_body = strip_tags(General::reverse_sanitize(General::reverse_sanitize($comment_body))); $comment_body_short = General::limitWords($comment_body, 75); if (strlen($comment_body_short) < strlen($comment_body)) { $comment_body_short .= "..."; } $class = ""; if (isset($_REQUEST['_f']) && $_REQUEST['id'] == $comment['id']) { $class = "active "; } if ($bEven) { $class .= "even"; } $class = trim($class); ?> <tr<?php