public static function Unsubscribe($subscribe) { Table::Delete('subscribe', $subscribe['email'], 'email'); /* notice */ $host = $_SERVER['HTTP_HOST']; /* $u = "http://notice.zuitu.com/unsubscribe.php?email={$subscribe['email']}&secret={$subscribe['secret']}&host={$host}"; Utility::HttpRequest($u); */ }
public static function DeleteTeam($id) { $orders = Table::Fetch('order', array($id), 'team_id'); foreach ($orders as $one) { if ($one['state'] == 'pay') { return false; } if ($order['card_id']) { Table::UpdateCache('card', $order['card_id'], array('team_id' => 0, 'order_id' => 0, 'consume' => 'N')); } Table::Delete('order', $one['id']); } return Table::Delete('team', $id); }
public static function Enable($mobile, $enable = false, $user_id = '') { $condition = array('tools' => $mobile, 'enable' => 'Y'); $remove = DB::GetTableRow('toolsbind', $condition); if ($remove) { Table::Delete('toolsbind', $remove['id']); } $havecondition = array('user_id' => $user_id, 'enable' => 'Y'); $removeold = DB::GetTableRow('toolsbind', $havecondition); if ($removeold) { Table::Delete('toolsbind', $removeold['id']); } $sms = Table::Fetch('toolsbind', $mobile, 'tools'); $time = time(); if ($sms) { Table::UpdateCache('toolsbind', $sms['id'], array('enable' => 'Y', 'create_time' => $time)); Table::UpdateCache('user', $sms['user_id'], array('mobile' => $mobile, 'mobilecode' => 'yes', 'enable' => 'Y')); } }
)); $cond = array( 'team_id' => $id ); $count = Table::Count('voucher', $cond); Table::UpdateCache('team', $id, array('max_number'=> $count)); Session::Set('notice', '未下发的商户券清空完成'); json(null, 'refresh'); } if ( 'removeonevoucher' == $action ) { $vid = strval($_GET['vid']); $voucher = Table::Fetch('voucher', $vid); if ($voucher['order_id']) { json('商户券已分配,不可删除', 'alert'); } else if (!$voucher ) { json('商户券不存在', 'alert'); } Table::Delete('voucher', $vid); $cond = array( 'team_id' => $voucher['team_id'] ); $count = Table::Count('voucher', $cond); Table::UpdateCache('team', $voucher['team_id'], array( 'max_number' => $count )); Session::Set('notice', '商户券删除成功'); json(null, 'refresh'); } else if('smsexpress' == $action ) { $con_pay = array( 'team_id' => $id, 'state' => 'pay', ); $con_smsneed = array( 'team_id' => $id, 'state' => 'pay',
<?php require_once dirname(dirname(dirname(__FILE__))) . '/app.php'; need_manager(); need_auth('market'); $action = strval($_GET['action']); $id = abs(intval($_GET['id'])); $r = udecode($_GET['r']); $cate = strval($_GET['cate']); $like = strval($_GET['like']); if ($action == 'r') { Table::Delete('feedback', $id); redirect($r); } else { if ($action == 'm') { Table::UpdateCache('feedback', $id, array('user_id' => $login_user_id)); redirect($r); } } $condition = array(); if ($cate) { $condition['category'] = $cate; } if ($like) { $condition[] = "content like '%" . mysql_escape_string($like) . "%'"; } $count = Table::Count('feedback', $condition); list($pagesize, $offset, $pagestring) = pagestring($count, 20); $asks = DB::LimitQuery('feedback', array('condition' => $condition, 'order' => 'ORDER BY id DESC', 'size' => $pagesize, 'offset' => $offset)); $user_ids = Utility::GetColumn($asks, 'user_id'); $users = Table::Fetch('user', $user_ids);
<?php require_once dirname(dirname(__FILE__)) . '/app.php'; need_login(); $action = strval($_GET['action']); $aid = strval($_GET['id']); if ('modify' == $action) { if ($aid) { $address = Table::Fetch('user_address', $aid); if (!$address) { json('无数据', 'alert'); } } $html = render('ajax_dialog_address'); json($html, 'dialog'); } else { if ($action == 'delete') { $addr = Table::Fetch('user_address', $aid); if (!$addr) { json('无数据', 'alert'); } Table::Delete('user_address', $aid); Session::Set('notice', '删除地址成功'); json(null, 'refresh'); } }
$field = "image{$v}"; $relpath = $team[$field]; $abspath = WWW_ROOT . '/static/' . $relpath; if (file_exists($abspath) && @unlink($abspath)) { Table::UpdateCache('team', $id, array($field => null)); json(array(array('data' => '删除图片成功', 'type' => 'alert'), array('data' => "X.team.imageremovecall({$v});", 'type' => 'eval')), 'mix'); } json('删除图片失败', 'alert'); } else { if ('link' == $action) { if ($id) { $link = Table::Fetch('friendlink', $id); } $html = render('manage_ajax_dialog_misclink'); json($html, 'dialog'); } else { if ('linkremove' == $action) { if ($id) { $link = Table::Fetch('friendlink', $id); } if (!$link) { json('输入信息不正确', 'alert'); } Table::Delete('friendlink', $id); Session::Set('notice', '删除链接成功'); json(null, 'refresh'); } } } } }
<?php require_once dirname(dirname(dirname(__FILE__))) . '/app.php'; need_manager(); $id = abs(intval($_GET['id'])); $team = Table::Fetch('team', $id); $order = Table::Fetch('order', $id, 'team_id'); if ($order) { Session::Set('notice', "删除团购({$id})记录失败,存在订单记录"); } else { Table::Delete('team', $id); Session::Set('notice', "删除团购({$id})记录成功"); } Utility::Redirect(udecode($_GET['r']));
public static function Unsubscribe($subscribe) { Table::Delete('subscribe', $subscribe['email'], 'email'); }
<?php require_once dirname(dirname(__FILE__)) . '/app.php'; need_manager(); $action = strval($_GET['action']); $id = $topic_id = abs(intval($_GET['id'])); $topic = Table::Fetch('topic', $id); $pid = abs(intval($topic['parent_id'])); if (!$topic || !$id) { json('话题不存在', 'alert'); } elseif ($action == 'topicremove') { if ($pid == 0) { Table::Delete('topic', $id); Table::Delete('topic', $id, 'parent_id'); } else { Table::Delete('topic', $id); Table::UpdateCache('topic', $pid, array('reply_number' => Table::Count('topic', array('parent_id' => $pid)))); } Session::Set('notice', '删除帖子成功'); json(null, 'refresh'); } elseif ($action == 'topichead') { if ($topic['parent_id'] > 0) { json('只有主话题才能置顶', 'alert'); } $head = $topic['head'] == 0 ? time() : 0; Table::UpdateCache('topic', $id, array('head' => $head)); $tip = $head ? '设置话题置顶成功' : '取消话题置顶成功'; Session::Set('notice', $tip); json(null, 'refresh'); }
exit; } $table = new Table('vote_question', $question); $up_array = array('is_show'); $flag = $table->update($up_array); if ($flag) { Session::Set('notice', '修改状态成功'); } else { Session::Set('error', '修改状态失败'); } Utility::Redirect(WEB_ROOT . '/manage/vote/question.php?action=list-all'); exit; //删除 } elseif ($action == 'del') { $question['id'] = isset($_GET['id']) ? $_GET['id'] : '0'; $flag = Table::Delete('vote_question', $question['id']); if ($flag) { Session::Set('notice', '删除成功'); } else { Session::Set('error', '删除失败'); } Utility::Redirect(WEB_ROOT . '/manage/vote/question.php?action=list-all'); exit; //编辑问题 } elseif ($action == 'edit') { $id = isset($_GET['id']) && is_numeric($_GET['id']) ? $_GET['id'] : 0; $question = Table::Fetch('vote_question', $id); if (!$question) { Session::Set('error', '此问题不存在,请先添加。'); Utility::Redirect(WEB_ROOT . '/manage/vote/question.php?action=add'); exit;
need_auth('market'); $action = strval($_GET['action']); $id = abs(intval($_GET['id'])); if ('edit' == $action) { if ($id) { $goods = Table::Fetch('goods', $id); if (!$goods) { json('无数据', 'alert'); } } $html = render('manage_ajax_dialog_goodsedit'); json($html, 'dialog'); } elseif ('remove' == $action) { $goods = Table::Fetch('goods', $id); if (!$goods) { json('无数据', 'alert'); } Table::Delete('goods', $id); Session::Set('notice', '删除商品成功'); json(null, 'refresh'); } elseif ('disable' == $action) { $goods = Table::Fetch('goods', $id); if (!$goods) { json('无数据', 'alert'); } $enable = $goods['enable'] == 'Y' ? 'N' : 'Y'; $enablestring = $goods['enable'] == 'Y' ? '禁用' : '启用'; Table::UpdateCache('goods', $id, array('enable' => $enable)); Session::Set('notice', "{$enablestring}兑换商品成功"); json(null, 'refresh'); }
json(array(array('data' => "修改备注信息成功", 'type' => 'alert'), array('data' => null, 'type' => 'refresh')), 'mix'); } } } } } } } } } } } } } } } } } } } } } } } if ('newsremove' == $action) { need_auth('news'); $news = Table::Fetch('news', $id); Table::Delete('news', $id); Session::Set('notice', "新闻 {$id} 删除成功!"); json(null, 'refresh'); }
public static function UnSubscribe($mobile) { Table::Delete('smssubscribe', $mobile, 'mobile'); }
if ( 'delete' == $action ) { need_rbac_auth('user_delete',true); if ('Y'==$opuser['manager']) json('不能删除管理员用户', 'alert'); if (0<$opuser['money']) json('用户余额大于0,不能删除', 'alert'); $corder = Table::Count('order', array( 'user_id' => $id, 'state' => 'pay', )); if (0<$corder) json('用户已经产生付款订单,不能删除', 'alert'); Table::Delete('user', $id); Table::Delete('order', $id, 'user_id'); Table::Delete('flow', $id, 'user_id'); Table::Delete('coupon', $id, 'user_id'); Table::Delete('ask', $id, 'user_id'); Table::Delete('topic', $id, 'user_id'); Table::Delete('toolsbind', $id, 'user_id'); Session::Set('notice', '删除用户成功'); json(null, 'refresh'); } else if ( 'consume' == $action ) { need_rbac_auth('user_consume',true); $o_con = array( 'user_id' => $id, 'state' => 'pay', ); $corders = DB::LimitQuery('order', array( 'condition' => $o_con, 'order' => 'ORDER BY id DESC', )); $teams = Table::Fetch('team', Utility::GetColumn($corders, 'team_id'));
<?php require_once dirname(dirname(__FILE__)) . '/app.php'; need_login(); $action = strval($_GET['action']); $id = strval($_GET['id']); $v = strval($_GET['v']); if ('bindcancel' == $action) { Table::UpdateCache('user', $login_user['id'], array('mobilecode' => null)); json(array(array('data' => '取消手机绑定成功', 'type' => 'alert'), array('data' => null, 'type' => 'refresh')), 'mix'); } else { if ('deladd' == $action) { Table::Delete('address', $id); json(array(array('data' => '删除地址成功', 'type' => 'alert'), array('data' => null, 'type' => 'refresh')), 'mix'); } else { if ('setdefault' == $action) { DB::Update('address', array('user_id' => $login_user['id'], 'default' => 'Y'), array('default' => 'N')); DB::Update('address', array('id' => $id), array('default' => 'Y')); json(array(array('data' => '设置成功', 'type' => 'alert'), array('data' => null, 'type' => 'refresh')), 'mix'); } } }
} } elseif ($category['zone'] == 'group') { $tcount = Table::Count('team', array('group_id' => $id)); if ($tcount) { json('Deals in this category', 'alert'); } } Table::Delete('category', $id); Session::Set('notice', 'Delete OK'); json(null, 'refresh'); } else { if ('groupremove' == $action) { $group = Table::Fetch('user_group', $id); $count = Table::Count('user', array('user_group_id' => $id)); if ($group && $count == 0) { Table::Delete('user_group', $id); Session::Set('notice', "User Group {$id} deleted"); json(null, 'refresh'); } if ($count > 0) { json('User Group has users, cannot delete', 'alert'); } json('User Group delete error.', 'alert'); } elseif ('charityedit' == $action) { if ($id) { $charity = Table::Fetch('charity', $id); if (!$charity) { json('No Data', 'alert'); } } $html = render('ajax_dialog_charityedit');
} $feedback_input_list = DB::LimitQuery('vote_feedback_input', array('condition' => array("`feedback_id` = '{$feedback['id']}'"), 'order' => 'ORDER BY id', 'size' => 100, 'offset' => $offset)); if (is_array($feedback_input_list)) { foreach ($feedback_input_list as $one) { $feedback_input_list_new[$one['options_id']] = $one; } $feedback_input_list = $feedback_input_list_new; } include template('manage_vote_feedback_view'); exit; //删除 } elseif ($action == 'del') { $feedback_id = isset($_GET['id']) ? $_GET['id'] : '0'; $flag_feedback = Table::Delete('vote_feedback', $feedback_id, 'id'); $flag_feedback_question = Table::Delete('vote_feedback_question', $feedback_id, 'feedback_id'); $flag_feedback_input = Table::Delete('vote_feedback_input', $feedback_id, 'feedback_id'); if ($flag_feedback && $flag_feedback_question && $flag_feedback_input) { Session::Set('notice', '删除成功'); } else { Session::Set('error', '删除失败'); } redirect(WEB_ROOT . '/manage/vote/feedback.php?action=list'); exit; //问题列表 } elseif ($action == 'question_list') { $show_all = isset($_GET['show_all']) && $_GET['show_all'] ? true : false; $condition = array(); if (!$show_all) { $condition[] = "`is_show` = 1"; } $count = Table::Count('vote_question', $condition);
$tcount = Table::Count('team', array('group_id' => $id)); if ($tcount) { json('本类下存在团购项目', 'alert'); } } elseif ($category['zone'] == 'express') { $tcount = Table::Count('order', array('express_id' => $id)); if ($tcount) { json('本类下存在订单项目', 'alert'); } } elseif ($category['zone'] == 'public') { $tcount = Table::Count('topic', array('public_id' => $id)); if ($tcount) { json('本类下存在讨论区话题', 'alert'); } } Table::Delete('category', $id); option_category($category['zone']); Session::Set('notice', '删除分类成功'); json(null, 'refresh'); } else { if ('teamcoupon' == $action) { need_auth('team'); $team = Table::Fetch('team', $id); team_state($team); if ($team['now_number'] < $team['min_number']) { json('团购未结束或未达到最低成团人数', 'alert'); } /* all orders */ $all_orders = DB::LimitQuery('order', array('condition' => array('team_id' => $id, 'state' => 'pay'))); $all_orders = Utility::AssColumn($all_orders, 'id'); $all_order_ids = Utility::GetColumn($all_orders, 'id');
protected function DeleteById($table_prefix, $args) { $table_name = $table_prefix . '_metas'; $id = $args[0]; return Table::Delete($table_name, $id); }
<?php require_once(dirname(dirname(dirname(__FILE__))) . '/app.php'); need_manager(); need_auth('admin'); $action = strval($_GET['action']); $id = abs(intval($_GET['id'])); $opuser = Table::Fetch('user', $id); if ( 'delete' == $action ) { Table::Delete('user_denglu', $id); Session::Set('notice', '删除用户成功'); json(null, 'refresh'); }
<?php require_once dirname(dirname(dirname(__FILE__))) . '/app.php'; need_manager(); need_auth('ask'); $id = abs(intval($_GET['id'])); Table::Delete('ask', $id); Session::Set('notice', "删除团购咨询({$id})记录成功"); redirect(udecode($_GET['r']));
<?php require_once dirname(dirname(dirname(__FILE__))) . '/app.php'; need_manager(); need_auth('admin'); $action = strval($_GET['action']); $id = abs(intval($_GET['id'])); $opuser = Table::Fetch('user', $id); if ('delete' == $action) { if ('Y' == $opuser['manager']) { json('不能删除管理员用户', 'alert'); } if (0 < $opuser['money']) { json('用户余额大于0,不能删除', 'alert'); } $corder = Table::Count('order', array('user_id' => $id, 'state' => 'pay')); if (0 < $corder) { json('用户已经产生付款订单,不能删除', 'alert'); } Table::Delete('user', $id); Table::Delete('order', $id, 'user_id'); Table::Delete('flow', $id, 'user_id'); Table::Delete('coupon', $id, 'user_id'); Table::Delete('ask', $id, 'user_id'); Table::Delete('topic', $id, 'user_id'); Session::Set('notice', '删除用户成功'); json(null, 'refresh'); }
if (!($order['pay_id'] && (preg_match('#-(\\d+)-(\\d+)-#', $order['pay_id'], $m) && ($m[1] == $order['id'] && $m[2] == $order['quantity'])))) { $randid = strtolower(Utility::GenSecret(4, Utility::CHAR_WORD)); $pay_id = "go-{$order['id']}-{$order['quantity']}-{$randid}"; Table::UpdateCache('order', $order['id'], array('pay_id' => $pay_id)); $order['pay_id'] = $pay_id; } /* end */ //payed order if ($order['state'] == 'pay') { Session::Set('notice', '本单已支付成功'); redirect("team.php?id={$order['team_id']}"); } $team = Table::Fetch('team', $order['team_id']); if ($login_user['money'] >= $order['origin']) { $order['service'] = 'credit'; } else { Session::Set('error', '余额不足,请去网页版本先行充值!'); redirect('index.php'); } if ($_POST['service'] == 'credit') { if ($order['origin'] > $login_user['money']) { Table::Delete('order', $order_id); redirect('index.php'); } Table::UpdateCache('order', $order_id, array('service' => 'credit', 'money' => 0, 'state' => 'pay', 'credit' => $order['origin'], 'pay_time' => time())); $order = Table::FetchForce('order', $order_id); ZTeam::BuyOne($order); Session::Set('notice', '购买成功'); redirect("order.php?id={$order_id}"); } die(include template('wap_pay'));
} $error = ZCard::Explain($ret); json($error, 'alert'); } elseif ($action == 'orderdel') { $order = Table::Fetch('order', $order_id); if (!$order || $order['user_id'] != $login_user_id) { json('订单记录不存在', 'alert'); } if ($order['state'] != 'unpay') { json('付款订单不能删除', 'alert'); } /* card refund */ if ($order['card_id']) { Table::UpdateCache('card', $order['card_id'], array('consume' => 'N', 'team_id' => 0, 'order_id' => 0)); } Table::Delete('order', $order['id']); Session::Set('notice', "删除订单 {$order['id']} 成功"); json(null, 'refresh'); } else { if ($action == 'coupon') { $order = Table::Fetch('order', $order_id); $team = Table::Fetch('team', $order['team_id']); // coupon list $couponList = DB::LimitQuery('coupon', array('condition' => array('order_id' => $order_id))); $html = render('ajax_dialog_order_coupon'); json($html, 'dialog'); } else { if ($action == 'sendcoupon') { $order = Table::Fetch('order', $order_id); $team = Table::Fetch('team', $order['team_id']); // coupon list
} } } } } } } } } } } } } } } } } if ('newsremove' == $action) { need_auth('news'); $news = Table::Fetch('news', $id); Table::Delete('news', $id); Session::Set('notice', "新闻 {$id} 删除成功!"); json(null, 'refresh'); } if ('mltadremove' == $action) { need_auth('mltad'); $news = Table::Fetch('mltad', $id); Table::Delete('mltad', $id); Session::Set('notice', "广告 {$id} 删除成功!"); json(null, 'refresh'); }
$options['is_show'] = isset($_GET['value']) && $_GET['value'] ? 1 : 0; $options_check = Table::Count('vote_options', array("id = '{$options['id']}'")); if (!$options_check) { Session::Set('error', '此选项不存在,请先添加。'); Utility::Redirect(WEB_ROOT . '/manage/vote/options.php?action=add&question_id=' . $question['id']); exit; } $table = new Table('vote_options', $options); $up_array = array('is_show'); $flag = $table->update($up_array); if ($flag) { Session::Set('notice', '修改选项状态成功'); } else { Session::Set('error', '修改选项状态失败'); } Utility::Redirect(WEB_ROOT . '/manage/vote/options.php?action=list&question_id=' . $question['id']); exit; //删除 } elseif ($action == 'del') { $options['id'] = isset($_GET['id']) ? $_GET['id'] : '0'; $flag = Table::Delete('vote_options', $options['id']); if ($flag) { Session::Set('notice', '删除选项成功'); } else { Session::Set('error', '删除选项失败'); } Utility::Redirect(WEB_ROOT . '/manage/vote/options.php?action=list&question_id=' . $question['id']); exit; } Utility::Redirect(WEB_ROOT . '/manage/vote/options.php?action=list&question_id=' . $question_id); exit;