function formatResult($result) { global $_PB_CACHE, $form; if (class_exists("Trade")) { $trade_controller = new Trade(); } else { uses("trade"); $trade_controller = new Trade(); } if (!empty($result)) { if (empty($_PB_CACHE['trusttype'])) { require CACHE_PATH . 'cache_trusttype.php'; } $result_count = count($result); for ($i = 0; $i < $result_count; $i++) { if (empty($result[$i]['userid'])) { $result[$i]['userid'] = $result[$i]['username']; } if (!empty($result[$i]['formattribute_ids'])) { $tmp_arr = $form->getAttribute(explode(",", $result[$i]['formattribute_ids'])); if (!empty($tmp_arr)) { foreach ($tmp_arr as $key => $val) { $result[$i][$key] = $val; } } } $result[$i]['im'] = $this->formatIM($result[$i]['cache_contacts']); $result[$i]['pubdate'] = @date("Y-m-d", $result[$i]['submit_time']); $result[$i]['content'] = strip_tags($result[$i]['content']); $result[$i]['url'] = $trade_controller->rewrite($result[$i]['id'], $result[$i]['type_id']); if (!empty($result[$i]['membergroup_id'])) { $result[$i]['gradeimg'] = 'images/group/' . $_PB_CACHE['membergroup'][$result[$i]['membergroup_id']]['avatar']; $result[$i]['gradename'] = $_PB_CACHE['membergroup'][$result[$i]['membergroup_id']]['name']; } $result[$i]['image'] = pb_get_attachmenturl($result[$i]['picture'], '', 'middle'); $trusttype_images = null; if (!empty($result[$i]['trusttype_ids'])) { $tmp_trusttype = explode(",", $result[$i]['trusttype_ids']); foreach ($tmp_trusttype as $val) { $trusttype_images .= '<img src="' . $_PB_CACHE['trusttype'][$val]['avatar'] . '" alt="' . $_PB_CACHE['trusttype'][$val]['name'] . '" />'; } } $result[$i]['trusttype'] = $trusttype_images; } return $result; } else { return null; } }