define('IN_ECS', true); require dirname(__FILE__) . '/includes/init.php'; admin_priv('attention_list'); if ($_REQUEST['act'] == 'list') { $goodsdb = get_attention(); $smarty->assign('full_page', 1); $smarty->assign('ur_here', $_LANG['attention_list']); $smarty->assign('goodsdb', $goodsdb['goodsdb']); $smarty->assign('filter', $goodsdb['filter']); $smarty->assign('cfg_lang', $_CFG['lang']); $smarty->assign('record_count', $goodsdb['record_count']); $smarty->assign('page_count', $goodsdb['page_count']); assign_query_info(); $smarty->display('attention_list.htm'); } elseif ($_REQUEST['act'] == 'query') { $goodsdb = get_attention(); $smarty->assign('goodsdb', $goodsdb['goodsdb']); $smarty->assign('filter', $goodsdb['filter']); $smarty->assign('record_count', $goodsdb['record_count']); $smarty->assign('page_count', $goodsdb['page_count']); make_json_result($smarty->fetch('attention_list.htm'), '', array('filter' => $goodsdb['filter'], 'page_count' => $goodsdb['page_count'])); } elseif ($_REQUEST['act'] == 'addtolist') { $id = intval($_REQUEST['id']); $pri = intval($_REQUEST['pri']) == 1 ? 1 : 0; $start = empty($_GET['start']) ? 0 : (int) $_GET['start']; $sql = "SELECT count(*) FROM " . $GLOBALS['ecs']->table('goods') . " g" . " LEFT JOIN " . $GLOBALS['ecs']->table('collect_goods') . " c" . " ON g.goods_id = c.goods_id" . " LEFT JOIN " . $GLOBALS['ecs']->table('users') . " u" . " ON c.user_id = u.user_id" . " WHERE c.is_attention = 1 AND g.is_delete = 0 AND c.goods_id = '{$id}'"; $count = $db->getOne($sql); if ($count > $start) { $sql = "SELECT u.user_name, u.email, g.goods_name, g.goods_id FROM " . $GLOBALS['ecs']->table('goods') . " g LEFT JOIN " . $GLOBALS['ecs']->table('collect_goods') . " c ON g.goods_id = c.goods_id LEFT JOIN " . $GLOBALS['ecs']->table('users') . " u ON c.user_id = u.user_id" . " WHERE c.is_attention = 1 AND g.is_delete = 0 AND c.goods_id = '{$id}' LIMIT {$start},100"; $query = $db->query($sql); $add = '';
$validation_one = valid_email($visitormail); $validation_two = missing_data($visitor, $visitormail, $notes); $validation_three = missing_attention($attention); if (!empty($validation_three)) { $error_message = $validation_three; } if (!empty($validation_two)) { $error_message = $validation_two; } if (!empty($validation_one)) { $error_message = $validation_one; } if (empty($validation_one) && empty($validation_two) && empty($validation_three)) { $today_is = date("l, F j, Y, g:i a"); $notes = stripcslashes($notes); $attention_values = get_attention($attention); $subject = "To " . $attention_values[1] . " from ynotradio.net"; $message = build_message($today_is, $attention_values, $notes, $visitor, $visitormail); $from = "From: {$visitormail}\r\n"; send_mail($attention_values[0], $subject, $message, $from); echo "<div class=\"success center\">\n <h2>" . ucfirst($visitor) . ", thanks for your message!</h2>\n </div>"; } else { echo "<div class=\"center error\">" . $error_message . "</div>"; } function valid_email($visitormail) { if (!empty($visitormail) && (!strstr($visitormail, "@") || !strstr($visitormail, "."))) { return "Use the back button and enter a valid e-mail address.\n<br>\nYour feedback was not submitted.\n"; } } function missing_data($visitor, $visitormail, $notes)