예제 #1
1
function show_page($page)
{
    $template = "view/templates/default_template.php";
    if (file_exists($template) && is_file($template)) {
        require_once $template;
    } else {
        require_once "view/templates/default_template.php";
    }
    echo get_document_head();
    echo get_header_start();
    if (is_logged_in()) {
        echo get_logout();
    } else {
    }
    echo get_header_end();
    if (is_logged_in()) {
        echo get_menu();
    } else {
        echo get_guest_menu();
    }
    if (is_logged_in()) {
        if ($page == "startpage") {
            echo "startpage";
        } else {
            if ($page == "fileupload") {
                echo get_fileupload();
            } else {
                if ($page == "nyheter") {
                    echo get_news();
                } else {
                    if ($page == "flowing") {
                        echo get_flowing();
                    } else {
                        if ($page == "event") {
                            echo get_event();
                        } else {
                            if ($page == "profile") {
                                $user_id = 1;
                                echo get_profile($user_id);
                            } else {
                                echo get_default("");
                            }
                        }
                    }
                }
            }
        }
    } else {
        echo get_login();
    }
    echo get_footer();
    echo get_document_end();
}
예제 #2
0
파일: dp_msg.php 프로젝트: macall/jsd
 /**
  * 加载相应的类型消息
  * @param unknown_type $msg  数据集(即数据库中的对应消息行)
  *
  * 返回:array("id"=>"当前消息ID",title="标题",is_read=>"是否已读","icon"=>"相关数据的图片(可为空)","content"=>"内容","create_time"=>"时间","link"=>"(可为空)相关数据的跳转链接");
  */
 public function load_msg($msg)
 {
     if (!$msg['data']) {
         $data = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "supplier_location_dp where id = " . $msg['data_id']);
         if ($data['deal_id'] > 0) {
             require_once APP_ROOT_PATH . "system/model/deal.php";
             $data_info = get_deal($data['deal_id']);
             $data['url'] = $data_info['url'];
             $data['icon'] = $data_info['icon'];
             $data['title'] = $data_info['name'];
         } elseif ($data['youhui_id'] > 0) {
             require_once APP_ROOT_PATH . "system/model/youhui.php";
             $data_info = get_youhui($data['youhui_id']);
             $data['url'] = $data_info['url'];
             $data['icon'] = $data_info['icon'];
             $data['title'] = $data_info['name'];
         } elseif ($data['event_id'] > 0) {
             require_once APP_ROOT_PATH . "system/model/event.php";
             $data_info = get_event($data['event_id']);
             $data['url'] = $data_info['url'];
             $data['icon'] = $data_info['icon'];
             $data['title'] = $data_info['name'];
         } else {
             require_once APP_ROOT_PATH . "system/model/supplier.php";
             $data_info = get_location($data['supplier_location_id']);
             $data['url'] = $data_info['url'];
             $data['icon'] = $data_info['preview'];
             $data['title'] = $data_info['name'];
         }
         $msg['data'] = serialize($data);
         $GLOBALS['db']->autoExecute(DB_PREFIX . "msg_box", $msg, "UPDATE", "id=" . $msg['id'], "SILENT");
     }
     $data = unserialize($msg['data']);
     $msg['icon'] = $data['icon'];
     $msg['link'] = $data['url'];
     $msg['title'] = "对 [" . $data['title'] . "] 的点评";
     $msg['short_title'] = "对 [" . msubstr($msg['title']) . "] 的点评";
     return $msg;
 }
예제 #3
0
 public function index()
 {
     $content = strim($GLOBALS['request']['content']);
     //点评内容
     $point = intval($GLOBALS['request']['point']);
     //点评分数
     $city_name = strim($GLOBALS['request']['city_name']);
     //城市名称
     $type = strim($GLOBALS['request']['type']);
     $id = intval($GLOBALS['request']['id']);
     $deal_id = 0;
     $youhui_id = 0;
     $location_id = 0;
     $event_id = 0;
     $tech_id = 0;
     if ($type == "deal") {
         $deal_id = $id;
         require_once APP_ROOT_PATH . "system/model/deal.php";
         $relate_data = get_deal($deal_id);
     } elseif ($type == "supplier") {
         $location_id = $id;
         require_once APP_ROOT_PATH . "system/model/supplier.php";
         $relate_data = get_location($location_id);
     } elseif ($type == "youhui") {
         $youhui_id = $id;
         require_once APP_ROOT_PATH . "system/model/youhui.php";
         $relate_data = get_youhui($youhui_id);
     } elseif ($type == "event") {
         $event_id = $id;
         require_once APP_ROOT_PATH . "system/model/event.php";
         $relate_data = get_event($event_id);
     } elseif ($type == "tech") {
         $tech_id = $id;
         require_once APP_ROOT_PATH . "system/model/tech.php";
         $relate_data = get_tech($tech_id);
     }
     //检查用户,用户密码
     $user = $GLOBALS['user_info'];
     $user_id = intval($user['id']);
     $root = array();
     $root['return'] = 1;
     if ($user_id > 0) {
         $GLOBALS['user_info'] = $user;
         $root['user_login_status'] = 1;
         require_once APP_ROOT_PATH . "system/model/review.php";
         require_once APP_ROOT_PATH . "system/model/deal.php";
         if ($type == "deal") {
             if ($relate_data['is_shop'] == 1) {
                 $cfg = load_dp_cfg(array("scate_id" => $relate_data['shop_cate_id']));
             } else {
                 $cfg = load_dp_cfg(array("cate_id" => $relate_data['cate_id']));
             }
         } elseif ($type == "event") {
             $cfg = load_dp_cfg(array("ecate_id" => $relate_data['cate_id']));
         } elseif ($type == "supplier") {
             $cfg = load_dp_cfg(array("cate_id" => $relate_data['deal_cate_id']));
         } elseif ($type == "youhui") {
             $cfg = load_dp_cfg(array("cate_id" => $relate_data['deal_cate_id']));
         } elseif ($type == "tech") {
         }
         $point_group = array();
         foreach ($cfg['point_group'] as $row) {
             $point_group[$row['id']] = $point;
         }
         $dp_img = array();
         if (count($_FILES['file']['name']) > 9) {
             $root['status'] = 0;
             $root['info'] = '上传图片不能超过9张';
         } else {
             //同步图片
             foreach ($_FILES['file']['name'] as $k => $v) {
                 $_files['file']['name'] = $v;
                 $_files['file']['type'] = $_FILES['file']['type'][$k];
                 $_files['file']['tmp_name'] = $_FILES['file']['tmp_name'][$k];
                 $_files['file']['error'] = $_FILES['file']['error'][$k];
                 $_files['file']['size'] = $_FILES['file']['size'][$k];
                 $res = upload_topic($_files);
                 if ($res['error'] == 0) {
                     $dp_img[] = $res['url'];
                 }
             }
             if ($content != '') {
                 $result = save_review($user_id, array("deal_id" => $deal_id, "youhui_id" => $youhui_id, "event_id" => $event_id, "location_id" => $location_id, "tech_id" => $tech_id), $content, $point, $dp_img, array(), $point_group);
             }
             //$result = add_deal_dp($user_id, $content, $point, $deal_id);
             $root['status'] = $result['status'];
             $root['info'] = $result['info'];
         }
     } else {
         $root['user_login_status'] = 0;
         $root['status'] = 0;
         $root['info'] = '请先登录';
     }
     $root['page_title'] = "发表点评";
     $root['city_name'] = $city_name;
     output($root);
 }
예제 #4
0
파일: event.php 프로젝트: pecey/Edge2k15
            $newname = $_POST['id'] . "." . $ext;
            $target = 'pdfs/' . $newname;
            move_uploaded_file($_FILES['pdf']['tmp_name'], $target);
            update_event($_POST['id'], stripslashes($_POST['description']), $target);
        }
        $id = $_POST['id'];
        $contact_id1 = $_POST['contact_id1'];
        $contact_id2 = $_POST['contact_id2'];
        if ($contact_id1 == -1) {
            $contact_id1 = false;
        }
        if ($contact_id2 == -1) {
            $contact_id2 = false;
        }
        set_event_contacts($id, $contact_id1, $contact_id2);
        $event = get_event($_POST['id']);
    } else {
        redirect('events.php');
    }
}
?>

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Edge CMS</title>

    <!-- Bootstrap -->
예제 #5
0
 public function do_submit()
 {
     global_run();
     if (empty($GLOBALS['user_info'])) {
         $data['status'] = 1000;
         ajax_return($data);
     }
     $event_id = intval($_REQUEST['event_id']);
     require_once APP_ROOT_PATH . "system/model/event.php";
     $event = get_event($event_id);
     if (!$event) {
         $data['status'] = 0;
         $data['info'] = "活动不存在";
         ajax_return($data);
     }
     if ($event['submit_begin_time'] > NOW_TIME) {
         $data['status'] = 0;
         $data['info'] = "活动报名未开始";
         ajax_return($data);
     }
     if ($event['submit_end_time'] > 0 && $event['submit_end_time'] < NOW_TIME) {
         $data['status'] = 0;
         $data['info'] = "活动报名已结束";
         ajax_return($data);
     }
     if ($event['submit_count'] >= $event['total_count'] && $event['total_count'] > 0) {
         $data['status'] = 0;
         $data['info'] = "活动名额已满";
         ajax_return($data);
     }
     $user_id = intval($GLOBALS['user_info']['id']);
     $user_submit = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "event_submit where user_id = " . $user_id . " and event_id = " . $event_id);
     if ($user_submit) {
         if ($user_submit['is_verify'] == 1) {
             $data['status'] = 0;
             $data['info'] = "您已经报名";
             ajax_return($data);
         } elseif ($user_submit['is_verify'] == 2) {
             $data['status'] = 0;
             $data['info'] = "您的报名审核不通过";
             ajax_return($data);
         } else {
             //已经报名,仅作修改
             $GLOBALS['db']->query("delete from " . DB_PREFIX . "event_submit_field where submit_id = " . $user_submit['id']);
             $field_ids = $_REQUEST['field_id'];
             foreach ($field_ids as $field_id) {
                 $current_result = strim($_REQUEST['result'][$field_id]);
                 $field_data = array();
                 $field_data['submit_id'] = $user_submit['id'];
                 $field_data['field_id'] = $field_id;
                 $field_data['event_id'] = $event_id;
                 $field_data['result'] = $current_result;
                 $GLOBALS['db']->autoExecute(DB_PREFIX . "event_submit_field", $field_data, "INSERT");
             }
             $result['status'] = 1;
             $result['info'] = "报名修改成功";
             ajax_return($result);
         }
     } else {
         $GLOBALS['db']->query("update " . DB_PREFIX . "event set submit_count = submit_count+1 where id=" . $event_id . " and submit_count + 1 <= total_count and total_count > 0");
         if (!$GLOBALS['db']->affected_rows()) {
             $data['status'] = 0;
             $data['info'] = "活动名额已满";
             ajax_return($data);
         }
         if ($event['score_limit'] > 0 || $event['point_limit'] > 0) {
             $c_user_info = $GLOBALS['user_info'];
             if ($c_user_info['score'] < $event['score_limit']) {
                 $data['status'] = 0;
                 $data['info'] = "积分不足,不能报名";
                 ajax_return($data);
             }
             if ($c_user_info['point'] < $event['point_limit']) {
                 $data['status'] = 0;
                 $data['info'] = "经验不足,不能报名";
                 ajax_return($data);
             }
         }
         $submit_data = array();
         $submit_data['user_id'] = $user_id;
         $submit_data['event_id'] = $event_id;
         $submit_data['create_time'] = NOW_TIME;
         $submit_data['event_begin_time'] = $event['event_begin_time'];
         $submit_data['event_end_time'] = $event['event_end_time'];
         $submit_data['return_money'] = $event['return_money'];
         $submit_data['return_score'] = $event['return_score'];
         $submit_data['return_point'] = $event['return_point'];
         $GLOBALS['db']->autoExecute(DB_PREFIX . "event_submit", $submit_data, "INSERT");
         $submit_id = $GLOBALS['db']->insert_id();
         if ($submit_id) {
             $field_ids = $_REQUEST['field_id'];
             foreach ($field_ids as $field_id) {
                 $current_result = strim($_REQUEST['result'][$field_id]);
                 $field_data = array();
                 $field_data['submit_id'] = $submit_id;
                 $field_data['field_id'] = $field_id;
                 $field_data['event_id'] = $event_id;
                 $field_data['result'] = $current_result;
                 $GLOBALS['db']->autoExecute(DB_PREFIX . "event_submit_field", $field_data, "INSERT");
             }
             if ($event['is_auto_verify'] == 1) {
                 //自动审核,发券
                 $sn = verify_event_submit($submit_id);
             }
             //同步分享
             $title = "报名参加了" . $event['name'];
             $content = "报名参加了" . $event['name'] . " - " . $event['brief'];
             $url_route = array('rel_app_index' => 'index', 'rel_route' => 'event#' . $event['id'], 'rel_param' => '');
             require_once APP_ROOT_PATH . "system/model/topic.php";
             $tid = insert_topic($content, $title, $type = "eventsubmit", $group = "", $relay_id = 0, $fav_id = 0, $group_data = "", $attach_list = array(), $url_route);
             if ($tid) {
                 $GLOBALS['db']->query("update " . DB_PREFIX . "topic set source_name = '网站' where id = " . intval($tid));
             }
             require_once APP_ROOT_PATH . "system/model/user.php";
             modify_account(array("score" => "-" . $event['score_limit']), $user_id, "活动报名:" . $event['name']);
             $data['status'] = 1;
             $data['info'] = "报名成功";
             if ($sn) {
                 $data['info'] .= ",验证码:" . $sn;
             }
             rm_auto_cache("event", array("id" => $event['id']));
             ajax_return($data);
         } else {
             $data['status'] = 0;
             $data['info'] = "报名失败";
             ajax_return($data);
         }
     }
 }
예제 #6
0
 function handler_sub($page, $eid = null)
 {
     $this->load('xnetevents.inc.php');
     $page->changeTpl('xnetevents/subscribe.tpl');
     $evt = get_event($eid);
     if (is_null($evt)) {
         return PL_NOT_FOUND;
     }
     global $globals;
     if (!$evt['inscr_open']) {
         $page->kill('Les inscriptions pour cet événement sont closes');
     }
     if (!$evt['accept_nonmembre'] && !is_member() && !may_update()) {
         $url = $globals->asso('sub_url');
         if (empty($url)) {
             $url = $platal->ns . $globals->asso('diminutif') . "/" . 'subscribe';
         }
         $page->kill('Cet événement est réservé aux membres du groupe ' . $globals->asso('nom') . '. Pour devenir membre, rends-toi sur la page de <a href="' . $url . '">demande d\'inscripton</a>.');
     }
     $res = XDB::query("SELECT  stamp\n                             FROM  requests\n                            WHERE  type = 'paiements' AND data LIKE {?}", PayReq::same_event($eid, $globals->asso('id')));
     $page->assign('validation', $res->numRows());
     $page->assign('eid', $eid);
     $page->assign('event', $evt);
     $items = get_event_items($eid);
     $subs = get_event_subscription($eid, S::v('uid'));
     if (Post::has('submit')) {
         S::assert_xsrf_token();
         $moments = Post::v('moment', array());
         $pers = Post::v('personnes', array());
         $old_subs = $subs;
         $subs = array();
         foreach ($moments as $j => $v) {
             $subs[$j] = intval($v);
             // retrieve other field when more than one person
             if ($subs[$j] == 2) {
                 if (!isset($pers[$j]) || !is_numeric($pers[$j]) || $pers[$j] < 0) {
                     $page->trigError("Tu dois choisir un nombre d'invités correct&nbsp;!");
                     return;
                 }
                 $subs[$j] = $pers[$j];
             }
         }
         // count what the user must pay, and what he manually paid
         $manual_paid = 0;
         foreach ($items as $item_id => $item) {
             if (array_key_exists($item_id, $old_subs)) {
                 $manual_paid += $old_subs[$item_id]['paid'];
             }
         }
         // impossible to unsubscribe if you already paid sthing
         if (!array_sum($subs) && $manual_paid != 0) {
             $page->trigError("Impossible de te désinscrire complètement " . "parce que tu as fait un paiement par " . "chèque ou par liquide. Contacte un " . "administrateur du groupe si tu es sûr de " . "ne pas venir.");
             $updated = false;
         } else {
             // update actual inscriptions
             $updated = subscribe(S::v('uid'), $eid, $subs);
         }
         if ($updated) {
             $evt = get_event_detail($eid);
             if ($evt['topay'] > 0) {
                 $page->trigSuccess('Ton inscription à l\'événement a été mise à jour avec succès, tu peux payer ta participation en cliquant ci-dessous');
             } else {
                 $page->trigSuccess('Ton inscription à l\'événement a été mise à jour avec succès.');
             }
             if ($evt['subscription_notification'] != 'nobody') {
                 $mailer = new PlMailer('xnetevents/subscription-notif.mail.tpl');
                 if ($evt['subscription_notification'] != 'creator') {
                     $admins = $globals->asso()->iterAdmins();
                     while ($admin = $admins->next()) {
                         $mailer->addTo($admin);
                     }
                 }
                 if ($evt['subscription_notification'] != 'animator') {
                     $mailer->addTo($evt['organizer']);
                 }
                 $mailer->assign('group', $globals->asso('nom'));
                 $mailer->assign('event', $evt['intitule']);
                 $mailer->assign('subs', $subs);
                 $mailer->assign('moments', $evt['moments']);
                 $mailer->assign('name', S::user()->fullName('promo'));
                 $mailer->send();
             }
         }
     }
     $subs = get_event_subscription($eid, S::v('uid'));
     // count what the user must pay
     $topay = 0;
     $manually_paid = 0;
     foreach ($items as $item_id => $item) {
         if (array_key_exists($item_id, $subs)) {
             $topay += $item['montant'] * $subs[$item_id]['nb'];
             $manually_paid += $subs[$item_id]['paid'];
         }
     }
     $paid = $manually_paid + get_event_telepaid($eid, S::v('uid'));
     $page->assign('moments', $items);
     $page->assign('subs', $subs);
     $page->assign('topay', $topay);
     $page->assign('paid', $paid);
 }
예제 #7
0
<?php

require_once "includes.php";
if (!isset($_GET["event"])) {
    header("Location: /" . SITE_ROOT);
}
$event = get_event($_GET["event"]);
if ($event == null) {
    header("Location: /" . SITE_ROOT);
}
if ($event["public"] == 0 && $event["account"] != $account && !(isset($_GET["key"]) && validate_invite($event["id"], $_GET["key"])) && !($account !== false && validate_invite_account($event["id"], $account))) {
    header("Location: /" . SITE_ROOT);
}
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    if ($account === false && (isset($_POST["name"]) && $_POST["name"] == "")) {
        echo "Please enter your name";
    } else {
        $intervals = array();
        $ids = get_schedules_for_event($event["id"]);
        foreach ($ids as $id) {
            array_push($intervals, array($id["id"], $_POST[$id["id"] . ""]));
        }
        $userid = 0;
        if ($account !== false) {
            $userid = add_vote("", $intervals, $event["id"], $account);
        } else {
            if ($event["public"] == 0) {
                $userid = add_vote(isset($_POST["name"]) ? $_POST["name"] : "", $intervals, $event["id"], 0, $_GET["key"]);
            } else {
                $userid = add_vote(isset($_POST["name"]) ? $_POST["name"] : "", $intervals, $event["id"]);
            }
예제 #8
0
파일: index.php 프로젝트: jcmackie/d2mt
 $team1 = trim($aGame->find('.opp1', 0)->plaintext);
 if (!$team1) {
     continue;
 }
 $img2 = strtolower(substr($aGame->find('.flag', 1)->class, -2));
 $img2 = $img2 == "un" ? "world" : $img2;
 $img2 = "http://cdn1.gamesports.net/img/flags/" . $img2 . ".gif";
 $team2 = trim($aGame->find('.opp2', 0)->plaintext);
 $linkID = "http://www.gosugamers.net" . $aGame->find('a', 0)->href;
 $titleList = file_get_html($linkID);
 $team1 = parse_name(trim($titleList->find('.opponent1', 0)->children(1)->plaintext));
 if (!$team1) {
     continue;
 }
 $team2 = parse_name(trim($titleList->find('.opponent2', 0)->children(1)->plaintext));
 $eventName = get_event($titleList);
 $fullDate = $titleList->find('.datetime', 0)->plaintext;
 $timeStamp = strtotime($fullDate);
 $score1 = 0 + trim($titleList->find('.match-extras .hidden span', 0)->plaintext);
 $score2 = 0 + trim($titleList->find('.match-extras .hidden span', 1)->plaintext);
 $series = "{$score1}:{$score2}";
 if ($score1 == $score2) {
     $winner = "x";
 } else {
     if ($score1 > $score2) {
         $team1 = '<b>' . $team1 . '</b>';
         $winner = ">";
     } else {
         $team2 = '<b>' . $team2 . '</b>';
         $winner = "<";
     }
예제 #9
0
        echo "Missing fields";
    } else {
        if ($_POST["type"] == "open" && date_diff(date_create($_POST["start"]), date_create($_POST["end"]))->format("%r") == "-") {
            echo "End date must be after start date";
        } else {
            $hash = "";
            $account_id = $account !== false ? $account : 0;
            $public = isset($_POST["public"]);
            $hidden = isset($_POST["hidden"]);
            if ($_POST["type"] == "open") {
                $hash = create_event($_POST["name"], $_POST["start"], $_POST["end"], $_POST["desc"], $_POST["type"], $account_id, $public, $hidden);
                header('Location: view?event=' . $hash);
            } else {
                if ($_POST["type"] == "centered") {
                    $hash = create_event($_POST["name"], date("Y-m-d H:i:s", 0), date("Y-m-d H:i:s", PHP_INT_MAX), $_POST["desc"], $_POST["type"], $account_id, $public, $hidden);
                    $id = get_event($hash)["id"];
                    $processor = new NaturalLanguageProcessor($_POST["proposal"], date("Y-m-d H:i:s", 0), date("Y-m-d H:i:s", PHP_INT_MAX));
                    if ($account !== false) {
                        put_schedule("", $processor->Process(), $id, $account, $_POST["proposal"]);
                    } else {
                        put_schedule($_POST["username"], $processor->Process(), $id, $_POST["proposal"]);
                    }
                    header('Location: view?event=' . $hash . "#share");
                }
            }
        }
    }
}
$title = "Create Event";
require_once "header.php";
?>
예제 #10
0
 $wants = $_GET['wants'];
 if ($wants == 'endpoints') {
     $endpoints = array();
     if (loginCheck($session)) {
         $endpoints = get_user_endpoints($_SESSION['ID']);
     }
     echo json_encode($endpoints);
 } else {
     if ($wants == 'notification') {
         if (in_array("Voting_End", get_event(1800))) {
             echo '{"title": "Film Night", "body": "Voting closes in half an hour. You still haven\'t voted.", "url": "voting.php"}';
         } else {
             if (in_array("Voting_End", get_event(3600))) {
                 echo '{"title": "Film Night", "body": "Voting closes in an hour. You still haven\'t voted.", "url": "voting.php"}';
             } else {
                 $now_events = get_event();
                 if (in_array("Roll_Call_Start", $now_events)) {
                     echo '{"title": "Film Night", "body": "Coming to film night this week? Roll Call!", "url": "settings.php"}';
                 } else {
                     if (in_array("Voting_Start", $now_events)) {
                         echo '{"title": "Film Night", "body": "Voting is open.", "url": "voting.php"}';
                     } else {
                         if (in_array("Results_Start", $now_events)) {
                             echo '{"title": "Film Night", "body": "The time is now. Results are available.", "url": "results.php"}';
                         } else {
                             echo '{"title": "Film Night", "body": "You have a notification but nothing is happening.", "url": "index.php"}';
                         }
                     }
                 }
             }
         }
예제 #11
0
 <p>Please <a href="https://films.jakestockwin.co.uk/voting.php">click here</a> to vote</p>
 <br>
 <p>Best wishes,<br>The HiveBot&trade;</p>
 </body>
 </html>
 ';
     mail($to, "Film Night Voting", $message, "Content-type:text/html");
     $webPush = new WebPush(array('GCM' => $push_api));
     $endpoints = get_endpoints("Voting_End30");
     // send multiple notifications
     foreach ($endpoints as $endpoint) {
         $webPush->sendNotification($endpoint['Endpoint']);
     }
     $webPush->flush();
 }
 if (in_array("Voting_End", get_event(3600))) {
     $to = get_emails("Voting_End60");
     $message = '
 <html>
 <body>
 <p>Dear HiveMember,</p>
 <p>You are yet to vote for this weeks film night. Voting closes in an hour.
 <p>Please <a href="https://films.jakestockwin.co.uk/voting.php">click here</a> to vote</p>
 <br>
 <p>Best wishes,<br>The HiveBot&trade;</p>
 </body>
 </html>
 ';
     mail($to, "Film Night Voting", $message, "Content-type:text/html");
     $webPush = new WebPush(array('GCM' => $push_api));
     $endpoints = get_endpoints("Voting_End60");
예제 #12
0
 public function save()
 {
     global_run();
     if (empty($GLOBALS['user_info'])) {
         $data['status'] = -1;
         $data['info'] = "";
         ajax_return($data);
     }
     require_once APP_ROOT_PATH . "system/model/review.php";
     $deal_id = intval($_REQUEST['deal_id']);
     $youhui_id = intval($_REQUEST['youhui_id']);
     $event_id = intval($_REQUEST['event_id']);
     $location_id = intval($_REQUEST['location_id']);
     $order_item_id = intval($_REQUEST['order_item_id']);
     $youhui_log_id = intval($_REQUEST['youhui_log_id']);
     $event_submit_id = intval($_REQUEST['event_submit_id']);
     $param = array("deal_id" => $deal_id, "youhui_id" => $youhui_id, "event_id" => $event_id, "location_id" => $location_id, "order_item_id" => $order_item_id, "youhui_log_id" => $youhui_log_id, "event_submit_id" => $event_submit_id);
     $checker = check_dp_status($GLOBALS['user_info']['id'], $param);
     if (!$checker['status']) {
         showErr($checker['info'], 1);
     }
     $content = strim(valid_str($_REQUEST['content']));
     //点评内容
     $dp_point = intval($_REQUEST['dp_point']);
     //总评分
     if ($dp_point <= 0) {
         $data['status'] = 0;
         $data['info'] = "请为总评打分";
         ajax_return($data);
     }
     $dp_image = array();
     //点评图片
     foreach ($_REQUEST['dp_image'] as $k => $v) {
         if (strim($v) != "") {
             $dp_image[] = strim($v);
         }
     }
     $tag_group = array();
     //标签分组
     foreach ($_REQUEST['dp_tags'] as $k => $tags_arr) {
         foreach ($tags_arr as $v) {
             if (strim($v) != "") {
                 $v_array = preg_split("/[ ,]/", $v);
                 foreach ($v_array as $kk => $vv) {
                     if (strim($vv) != "") {
                         $tag_group[$k][] = strim(valid_str($vv));
                     }
                 }
             }
         }
     }
     $point_group = array();
     //评分分组
     foreach ($_REQUEST['dp_point_group'] as $k => $v) {
         if (intval($v) > 0) {
             $point_group[$k] = intval($v);
         } else {
             $name = $GLOBALS['db']->getOne("select name from " . DB_PREFIX . "point_group where id = " . intval($k));
             $info = "请打分";
             if ($name) {
                 $info = "请为" . $name . "打分";
             }
             $data['status'] = 0;
             $data['info'] = $info;
             ajax_return($data);
         }
     }
     $result = save_review($GLOBALS['user_info']['id'], $param, $content, $dp_point, $dp_image, $tag_group, $point_group);
     if ($result['status']) {
         //分享
         $attach_list = array();
         if ($result['deal_id'] > 0) {
             require_once APP_ROOT_PATH . "system/model/deal.php";
             $deal_info = get_deal($result['deal_id']);
             if ($deal_info['uname'] != "") {
                 $url_key = $deal_info['uname'];
             } else {
                 $url_key = $deal_info['id'];
             }
             $type = "dealcomment";
             $url_route = array('rel_app_index' => 'index', 'rel_route' => 'deal#' . $url_key, 'rel_param' => '');
             //同步图片
             if ($deal_info['icon']) {
                 require_once APP_ROOT_PATH . "system/utils/es_imagecls.php";
                 $imagecls = new es_imagecls();
                 $info = $imagecls->getImageInfo(APP_ROOT_PATH . $deal_info['icon']);
                 $image_data['width'] = intval($info[0]);
                 $image_data['height'] = intval($info[1]);
                 $image_data['name'] = $deal_info['sub_name'];
                 $image_data['filesize'] = filesize(APP_ROOT_PATH . $deal_info['icon']);
                 $image_data['create_time'] = NOW_TIME;
                 $image_data['user_id'] = intval($GLOBALS['user_info']['id']);
                 $image_data['user_name'] = strim($GLOBALS['user_info']['user_name']);
                 $image_data['path'] = $deal_info['icon'];
                 $image_data['o_path'] = $deal_info['icon'];
                 $GLOBALS['db']->autoExecute(DB_PREFIX . "topic_image", $image_data);
                 $img_id = intval($GLOBALS['db']->insert_id());
                 $attach_list[] = array("type" => "image", "id" => intval($img_id));
             }
         } elseif ($result['youhui_id'] > 0) {
             require_once APP_ROOT_PATH . "system/model/youhui.php";
             $youhui_info = get_youhui($result['youhui_id']);
             $type = "youhuicomment";
             $url_route = array('rel_app_index' => 'index', 'rel_route' => 'youhui#' . $result['youhui_id'], 'rel_param' => '');
             //同步图片
             if ($youhui_info['icon']) {
                 require_once APP_ROOT_PATH . "system/utils/es_imagecls.php";
                 $imagecls = new es_imagecls();
                 $info = $imagecls->getImageInfo(APP_ROOT_PATH . $youhui_info['icon']);
                 $image_data['width'] = intval($info[0]);
                 $image_data['height'] = intval($info[1]);
                 $image_data['name'] = $youhui_info['name'];
                 $image_data['filesize'] = filesize(APP_ROOT_PATH . $youhui_info['icon']);
                 $image_data['create_time'] = NOW_TIME;
                 $image_data['user_id'] = intval($GLOBALS['user_info']['id']);
                 $image_data['user_name'] = strim($GLOBALS['user_info']['user_name']);
                 $image_data['path'] = $youhui_info['icon'];
                 $image_data['o_path'] = $youhui_info['icon'];
                 $GLOBALS['db']->autoExecute(DB_PREFIX . "topic_image", $image_data);
                 $img_id = intval($GLOBALS['db']->insert_id());
                 $attach_list[] = array("type" => "image", "id" => intval($img_id));
             }
         } elseif ($result['event_id'] > 0) {
             require_once APP_ROOT_PATH . "system/model/event.php";
             $event_info = get_event($result['youhui_id']);
             $type = "eventcomment";
             $url_route = array('rel_app_index' => 'index', 'rel_route' => 'event#' . $result['event_id'], 'rel_param' => '');
             //同步图片
             if ($event_info['icon']) {
                 require_once APP_ROOT_PATH . "system/utils/es_imagecls.php";
                 $imagecls = new es_imagecls();
                 $info = $imagecls->getImageInfo(APP_ROOT_PATH . $event_info['icon']);
                 $image_data['width'] = intval($info[0]);
                 $image_data['height'] = intval($info[1]);
                 $image_data['name'] = $event_info['name'];
                 $image_data['filesize'] = filesize(APP_ROOT_PATH . $event_info['icon']);
                 $image_data['create_time'] = NOW_TIME;
                 $image_data['user_id'] = intval($GLOBALS['user_info']['id']);
                 $image_data['user_name'] = strim($GLOBALS['user_info']['user_name']);
                 $image_data['path'] = $event_info['icon'];
                 $image_data['o_path'] = $event_info['icon'];
                 $GLOBALS['db']->autoExecute(DB_PREFIX . "topic_image", $image_data);
                 $img_id = intval($GLOBALS['db']->insert_id());
                 $attach_list[] = array("type" => "image", "id" => intval($img_id));
             }
         } else {
             require_once APP_ROOT_PATH . "system/model/supplier.php";
             $location_info = get_location($result['location_id']);
             $type = "slocationcomment";
             $url_route = array('rel_app_index' => 'index', 'rel_route' => 'store#' . $result['location_id'], 'rel_param' => '');
             //同步图片
             if ($location_info['preview']) {
                 require_once APP_ROOT_PATH . "system/utils/es_imagecls.php";
                 $imagecls = new es_imagecls();
                 $info = $imagecls->getImageInfo(APP_ROOT_PATH . $location_info['preview']);
                 $image_data['width'] = intval($info[0]);
                 $image_data['height'] = intval($info[1]);
                 $image_data['name'] = $location_info['name'];
                 $image_data['filesize'] = filesize(APP_ROOT_PATH . $location_info['preview']);
                 $image_data['create_time'] = NOW_TIME;
                 $image_data['user_id'] = intval($GLOBALS['user_info']['id']);
                 $image_data['user_name'] = strim($GLOBALS['user_info']['user_name']);
                 $image_data['path'] = $location_info['preview'];
                 $image_data['o_path'] = $location_info['preview'];
                 $GLOBALS['db']->autoExecute(DB_PREFIX . "topic_image", $image_data);
                 $img_id = intval($GLOBALS['db']->insert_id());
                 $attach_list[] = array("type" => "image", "id" => intval($img_id));
             }
         }
         foreach ($_REQUEST['topic_image_id'] as $att_id) {
             if (intval($att_id) > 0) {
                 $attach_list[] = array("type" => "image", "id" => intval($att_id));
             }
         }
         require_once APP_ROOT_PATH . "system/model/topic.php";
         $tid = insert_topic($content, "", $type, $group = "", $relay_id = 0, $fav_id = 0, $group_data = "", $attach_list, $url_route);
         if ($tid) {
             $GLOBALS['db']->query("update " . DB_PREFIX . "topic set source_name = '网站' where id = " . intval($tid));
         }
         $result['jump'] = url($url_route['rel_app_index'], $url_route['rel_route'], $url_route['rel_param']);
         ajax_return($result);
     } else {
         ajax_return($result);
     }
 }
예제 #13
0
<?php

include_once 'database.php';
$event = get_event();
$date = date('Y-m-d');
foreach ($event as $e) {
    if ($e['event_date'] < $date) {
        update_eventDate($e['eventID']);
    }
}
?>
<html>
	<head><title>PH directory - News Management</title></head>
	<body>
		<button class="btn btn-primary"><a href="index.php?page=event-add">Add Event</a></button>

		<table class="table">
			<thead>
				<tr>
					<td>Event No.</td>
					<td>Title</td>
					<td>Information</td>
					<td>Event Date</td>
					<td>Event status</td>
					<td>Date Posted</td>
					<td>Date Edited</td>
				<tr>
			</thead>
			
			<?php 
foreach ($event as $e) {
예제 #14
0
파일: model.php 프로젝트: echo0101/eScan
function scan_model()
{
    $eid = filter_input(INPUT_GET, 'eid', FILTER_SANITIZE_NUMBER_INT);
    $event_info = get_event($eid);
    return array("view" => "scan", "args" => array("eid" => $eid, "event_info" => $event_info));
}
예제 #15
0
 public function fetch($url_str)
 {
     //tuan.php?ctl=deal&id=39 | tuan/deal/39 //团购
     //shop.php?ctl=goods&id=48 | goods/id-48  //商品
     //youhui.php?ctl=ydetail&id=53|youhui/ydetail/id-53  //优惠
     //youhui.php?ctl=fdetail&id=15 | youhui/fdetail/id-15  //免费优惠
     //youhui.php?ctl=edetail&id=1 | youhui/edetail/id-1  //活动
     $url_str = str_replace("&amp;", "&", $url_str);
     $preg[] = $preg_tuan_o = "/index\\.php\\?ctl=(deal)\\&act=(\\w+)/i";
     $preg[] = $preg_tuan_r = "/(deal)\\/(\\w+)/i";
     $preg[] = $preg_fyouhui_o = "/index\\.php\\?ctl=(youhui)\\&act=(\\d+)/i";
     $preg[] = $preg_fyouhui_r = "/(youhui)\\/(\\d+)/i";
     $preg[] = $preg_event_o = "/index\\.php\\?ctl=(event)\\&act=(\\d+)/i";
     $preg[] = $preg_event_r = "/(event)\\/(\\d+)/i";
     $is_match = false;
     foreach ($preg as $preg_item) {
         if (preg_match_all($preg_item, $url_str, $matches)) {
             $is_match = true;
             break;
         }
     }
     if ($is_match) {
         $ctl = $matches[1][0];
         $data_id = strim($matches[2][0]);
         switch ($ctl) {
             case "deal":
                 //团购分享
                 require_once APP_ROOT_PATH . "system/model/deal.php";
                 $deal = get_deal($data_id);
                 if ($deal) {
                     $result['status'] = 1;
                     if ($deal['is_shop']) {
                         if ($deal['buy_type'] == 0) {
                             $title = "商品推荐:";
                         } elseif ($deal['buy_type'] == 1) {
                             $title = "积分商品推荐:";
                         }
                     } else {
                         $title = "团购推荐:";
                     }
                     $result['content'] = $title . $deal['sub_name'];
                     if ($deal['brief']) {
                         $result['content'] .= "[" . $deal['brief'] . "]";
                     }
                     $result['type'] = "sharedeal";
                     require_once APP_ROOT_PATH . "system/libs/words.php";
                     $tags = words::segment($deal['name']);
                     $result['tags'] = implode(" ", $tags);
                     $group_data['url']['app_index'] = "index";
                     $group_data['url']['route'] = "deal#" . $data_id;
                     $group_data['url']['param'] = '';
                     $group_data['data'] = $deal;
                     $result['group_data'] = base64_encode(serialize($group_data));
                     $result['images'] = array();
                     $deal_gallery = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "deal_gallery where deal_id = " . $deal['id'] . " order by sort asc");
                     foreach ($deal_gallery as $row) {
                         $result['images'][] = syn_image_to_topic($row['img']);
                     }
                 } else {
                     $result['status'] = 0;
                     $result['info'] = "团购商品不存在";
                 }
                 break;
             case "youhui":
                 require_once APP_ROOT_PATH . "system/model/youhui.php";
                 $youhui = get_youhui($data_id);
                 if ($youhui) {
                     $result['status'] = 1;
                     $result['content'] = "优惠券推荐:" . $youhui['name'];
                     $result['type'] = "shareyouhui";
                     require_once APP_ROOT_PATH . "system/libs/words.php";
                     $tags = words::segment($youhui['name']);
                     $result['tags'] = implode(" ", $tags);
                     $group_data['url']['app_index'] = "index";
                     $group_data['url']['route'] = "youhui#" . $data_id;
                     $group_data['url']['param'] = "";
                     $group_data['data'] = $youhui;
                     $result['group_data'] = base64_encode(serialize($group_data));
                     $result['images'][] = syn_image_to_topic($youhui['icon']);
                 } else {
                     $result['status'] = 0;
                     $result['info'] = "优惠券不存在";
                 }
                 break;
             case "event":
                 require_once APP_ROOT_PATH . "system/model/event.php";
                 $event = get_event($data_id);
                 if ($event) {
                     $result['status'] = 1;
                     $result['content'] = "活动推荐:" . $event['name'];
                     $result['type'] = "shareevent";
                     require_once APP_ROOT_PATH . "system/libs/words.php";
                     $tags = words::segment($event['name']);
                     $result['tags'] = implode(" ", $tags);
                     $group_data['url']['app_index'] = "index";
                     $group_data['url']['route'] = "event#" . $data_id;
                     $group_data['url']['param'] = "";
                     $group_data['data'] = $event;
                     $result['group_data'] = base64_encode(serialize($group_data));
                     $result['images'][] = syn_image_to_topic($event['icon']);
                 } else {
                     $result['status'] = 0;
                     $result['info'] = "活动不存在";
                 }
                 break;
             default:
                 $result['status'] = 0;
                 $result['info'] = "URL地址错误,该地址的数据无法分享";
                 break;
         }
     } else {
         $result['status'] = 0;
         $result['info'] = "URL地址错误,该地址的数据无法分享";
     }
     //		$result['status'] = 0;
     //		$result['info'] = print_r($matches,1);
     //		$result['group_data'] = "";
     //		$result['content'] = "你好";
     //		$result['tags'] = "好 一般 好不好";
     //		$result['images'] = array(array("id"=>108,"url"=>"./public/comment/201202/04/16/4c5971b0370e739c71ea9d0f5e2e35e257_100x100.jpg"));
     return $result;
 }
예제 #16
0
파일: import.php 프로젝트: ailurus1991/MRBS
        echo "</p>\n";
        trigger_error("Attempt to import a file that has not been uploaded", E_USER_WARNING);
    } else {
        $archive = get_archive_details($_FILES['upload_file']);
        if ($archive === FALSE) {
            echo "<p>" . get_vocab("could_not_process") . "</p>\n";
        } else {
            foreach ($archive['files'] as $file) {
                echo "<h3>" . $file['name'] . "</h3>";
                $n_success = 0;
                $n_failure = 0;
                $handle = fopen($archive['wrapper'] . '://' . $file['tmp_name'], 'rb');
                if ($handle === FALSE) {
                    echo "<p>" . get_vocab("could_not_process") . "</p>\n";
                } else {
                    while (FALSE !== ($vevent = get_event($handle))) {
                        process_event($vevent) ? $n_success++ : $n_failure++;
                    }
                    fclose($handle);
                    echo "<p>\n";
                    echo "{$n_success} " . get_vocab("events_imported");
                    if ($n_failure > 0) {
                        echo "<br>\n{$n_failure} " . get_vocab("events_not_imported");
                    }
                    echo "</p>\n";
                }
            }
        }
    }
}
// PHASE 1 - Get the user input
foreach ($event_ids as $event_id) {
    //echo $event_id, " : ";
    $users_attending = get_attendance($event_id, $facebook_id, $conn);
    $sum_similarity;
    settype($sum_similarity, "float");
    $sum_similarity = 0.0;
    foreach ($users_attending as $user) {
        //echo "sim of user_index(" , $user, ") is ---", $similarity_indices["$user"], "<br>";
        $sum_similarity += $similarity_indices["{$user}"];
    }
    if (count($users_attending) != 0) {
        $event_probablity["{$event_id}"] = floatval($sum_similarity / count($users_attending));
    } else {
        $event_probablity["{$event_id}"] = 0.0;
    }
    //echo "sum sim ", $sum_similarity, "count : ", count($users_attending), "<br>";
    //echo $event_probablity["$event_id"], "<br>";
}
//echo "-------SORTED ----- <br>";
arsort($event_probablity);
$return_arr = array();
$i = 0;
foreach ($event_probablity as $key => $value) {
    if ($i == 20) {
        break;
    }
    $i++;
    array_push($return_arr, get_event($key, $conn));
}
echo json_encode($return_arr);
$conn->close();
예제 #18
0
파일: feed.php 프로젝트: pecey/Edge2k15
<?php

include 'content/lib/database.php';
if (isset($_POST['event_id'])) {
    $event_id = $_POST['event_id'];
} else {
    return false;
}
$event_details = get_event($event_id);
$final = array();
if (isset($event_details['file']) && !empty($event_details['file'])) {
    $final['status'] = 1;
    $final['name'] = $event_details['name'];
    $final['desc'] = $event_details['description'];
    //$final['file']=str_replace("/","\/",$event_details['file']);
    $final['file'] = $event_details['file'];
    $final['contact1']['exists'] = 0;
    $final['contact2']['exists'] = 0;
    if (isset($event_details['contact_id1'])) {
        $final['contact1'] = get_contact($event_details['contact_id1']);
        $final['contact1']['exists'] = 1;
    }
    if (isset($event_details['contact_id2'])) {
        $final['contact2'] = get_contact($event_details['contact_id2']);
        $final['contact2']['exists'] = 1;
    }
} else {
    $final['name'] = $event_details['name'];
    $final['status'] = 0;
}
echo json_encode($final);
예제 #19
0
파일: review.php 프로젝트: macall/jsd
/**
 * 提交保存点评
 * @param unknown_type $user_id 提交点评的会员
 * @param unknown_type $param 参数 详细规则见 check_dp_status函数说明
 * @param unknown_type $content 点评文字内容
 * @param unknown_type $dp_point 总评分
 * @param unknown_type $dp_image 点评的图片数组 array("./public/...","./public/.....");
 * @param unknown_type $tag_group 点评标签(二维数组),格式如下
 * array(
 * 		"group_id" = array("tag","tag")
 * ); 其中group_id为分组的ID,第二维为每个分组中的tag
 * @param unknown_type $point_group 点评评分分组数据,格式如下
 * array(
 * 		"group_id" 	=>	"point"
 * ); 其中group_id为分组的ID,point为对应分组的评分
 * 
 * 返回 array("status"=>bool, "info"=>"消息","location_id"=>"门店的ID","deal_id"=>"","youhui_id"=>"","event_id"=>"");
 */
function save_review($user_id, $param = array("deal_id" => 0, "youhui_id" => 0, "event_id" => 0, "location_id" => 0, "order_item_id" => 0, "youhui_log_id" => 0, "event_submit_id" => 0), $content, $dp_point, $dp_image = array(), $tag_group = array(), $point_group = array())
{
    //获取参数
    $order_item_id = intval($param['order_item_id']);
    //订单商品ID
    $youhui_log_id = intval($param['youhui_log_id']);
    //优惠券领取日志ID
    $event_submit_id = intval($param['event_submit_id']);
    //活动报名日志ID
    if ($order_item_id > 0) {
        $deal_id = intval($GLOBALS['db']->getOne("select deal_id from " . DB_PREFIX . "deal_order_item where id = " . $order_item_id));
    } else {
        $deal_id = intval($param['deal_id']);
    }
    if ($youhui_log_id > 0) {
        $youhui_id = intval($GLOBALS['db']->getOne("select youhui_id from " . DB_PREFIX . "youhui_log where id = " . $youhui_log_id));
    } else {
        $youhui_id = intval($param['youhui_id']);
    }
    if ($event_submit_id > 0) {
        $event_id = intval($GLOBALS['db']->getOne("select event_id from " . DB_PREFIX . "event_submit where id = " . $event_submit_id));
    } else {
        $event_id = intval($param['event_id']);
    }
    $location_id = intval($param['location_id']);
    //部份初始化的变量
    $is_buy = 0;
    //默认的点评为非购物点评
    $avg_price = 0;
    //均价为0
    if ($deal_id > 0) {
        require_once APP_ROOT_PATH . "system/model/deal.php";
        $deal_info = get_deal($deal_id);
        if ($deal_info) {
            //验证是否可以点评
            $checker = check_dp_status($GLOBALS['user_info']['id'], array("deal_id" => $deal_id, "order_item_id" => $order_item_id));
            if (!$checker['status']) {
                return array("status" => false, "info" => $checker['info']);
            } else {
                $supplier_location_id = $checker['supplier_location_id'];
            }
            $is_buy = 1;
            $avg_price = $checker['avg_price'];
        } else {
            return array("status" => false, "info" => "你要点评的商品不存在");
        }
    } elseif ($youhui_id > 0) {
        require_once APP_ROOT_PATH . "system/model/youhui.php";
        $youhui_info = get_youhui($youhui_id);
        if ($youhui_info) {
            //验证是否可以点评
            $checker = check_dp_status($GLOBALS['user_info']['id'], array("youhui_id" => $youhui_id, "youhui_log_id" => $youhui_log_id));
            if (!$checker['status']) {
                return array("status" => false, "info" => $checker['info']);
            } else {
                $supplier_location_id = $checker['supplier_location_id'];
            }
        } else {
            return array("status" => false, "info" => "你要点评的优惠券不存在");
        }
    } elseif ($event_id > 0) {
        require_once APP_ROOT_PATH . "system/model/event.php";
        $event_info = get_event($event_id);
        if ($event_info) {
            //验证是否可以点评
            $checker = check_dp_status($GLOBALS['user_info']['id'], array("event_id" => $event_id, "event_submit_id" => $event_submit_id));
            if (!$checker['status']) {
                return array("status" => false, "info" => $checker['info']);
            } else {
                $supplier_location_id = $checker['supplier_location_id'];
            }
        } else {
            return array("status" => false, "info" => "你要点评的活动不存在");
        }
    } elseif ($location_id > 0) {
        require_once APP_ROOT_PATH . "system/model/supplier.php";
        $location_info = get_location($location_id);
        if ($location_info) {
            //验证是否可以点评
            $checker = check_dp_status($GLOBALS['user_info']['id'], array("location_id" => $location_id));
            if (!$checker['status']) {
                return array("status" => false, "info" => $checker['info']);
            } else {
                $supplier_location_id = $checker['supplier_location_id'];
            }
        } else {
            return array("status" => false, "info" => "你要点评的商家不存在");
        }
    }
    if ($deal_id == 0 && $youhui_id == 0 && $event_id == 0 && $location_id == 0) {
        return array("status" => false, "info" => "非法的数据");
    }
    //点评入库
    $supplier_info = $GLOBALS['db']->getRow("select name,id,new_dp_count_time,supplier_id from " . DB_PREFIX . "supplier_location where id = " . intval($supplier_location_id));
    $supplier_id = $supplier_info['supplier_id'];
    $dp_data = array();
    if ($content != "") {
        $dp_data['is_content'] = 1;
        $dp_data['content'] = $content;
    }
    $dp_data['create_time'] = NOW_TIME;
    $dp_data['point'] = $dp_point;
    $dp_data['user_id'] = $user_id;
    $dp_data['supplier_location_id'] = $supplier_location_id;
    $dp_data['youhui_id'] = $youhui_id;
    $dp_data['event_id'] = $event_id;
    $dp_data['deal_id'] = $deal_id;
    $dp_data['images_cache'] = serialize($dp_image);
    $dp_data['supplier_id'] = $supplier_id;
    $dp_data['status'] = 1;
    if (count($dp_image) > 0) {
        $dp_data['is_img'] = 1;
    }
    $dp_data['avg_price'] = floatval($avg_price);
    $GLOBALS['db']->autoExecute(DB_PREFIX . "supplier_location_dp", $dp_data, "INSERT");
    $dp_id = $GLOBALS['db']->insert_id();
    if ($dp_id > 0) {
        if ($checker['order_item_id']) {
            $GLOBALS['db']->query("update " . DB_PREFIX . "deal_order_item set dp_id = " . $dp_id . " where id = '" . $checker['order_item_id'] . "'");
            $order_id = intval($GLOBALS['db']->getOne("select order_id from " . DB_PREFIX . "deal_order_item where id = " . $checker['order_item_id']));
            update_order_cache($order_id);
            require_once APP_ROOT_PATH . "system/model/deal_order.php";
            distribute_order($order_id);
        }
        if ($checker['youhui_log_id']) {
            $GLOBALS['db']->query("update " . DB_PREFIX . "youhui_log set dp_id = " . $dp_id . " where id = '" . $checker['youhui_log_id'] . "'");
        }
        if ($checker['event_submit_id']) {
            $GLOBALS['db']->query("update " . DB_PREFIX . "event_submit set dp_id = " . $dp_id . " where id = '" . $checker['event_submit_id'] . "'");
        }
        increase_user_active($user_id, "发表了一则点评");
        $GLOBALS['db']->query("update " . DB_PREFIX . "user set dp_count = dp_count + 1 where id = " . $user_id);
        //创建点评图库
        if (count($dp_image) > 0) {
            foreach ($dp_image as $pkey => $photo) {
                //点评图片不入商户图片库
                // 				$c_data = array();
                // 				$c_data['image'] = $photo;
                // 				$c_data['sort'] = 10;
                // 				$c_data['create_time'] = NOW_TIME;
                // 				$c_data['user_id'] = $user_id;
                // 				$c_data['supplier_location_id'] = $supplier_location_id;
                // 				$c_data['dp_id'] = $dp_id;
                // 				$c_data['status'] = 0;
                // 				$GLOBALS['db']->autoExecute(DB_PREFIX."supplier_location_images", $c_data,"INSERT");
                $c_data = array();
                $c_data['image'] = $photo;
                $c_data['dp_id'] = $dp_id;
                $c_data['create_time'] = NOW_TIME;
                $c_data['location_id'] = $supplier_location_id;
                $c_data['supplier_id'] = $supplier_id;
                $GLOBALS['db']->autoExecute(DB_PREFIX . "supplier_location_dp_images", $c_data, "INSERT");
            }
        }
        //创建点评评分
        foreach ($point_group as $group_id => $point) {
            $point_data = array();
            $point_data['group_id'] = $group_id;
            $point_data['dp_id'] = $dp_id;
            $point_data['supplier_location_id'] = $supplier_location_id;
            $point_data['point'] = $point;
            $GLOBALS['db']->autoExecute(DB_PREFIX . "supplier_location_dp_point_result", $point_data, "INSERT");
            //创建商品点评数据
            if ($dp_data['deal_id'] > 0) {
                $point_data = array();
                $point_data['group_id'] = $group_id;
                $point_data['dp_id'] = $dp_id;
                $point_data['deal_id'] = $dp_data['deal_id'];
                $point_data['point'] = $point;
                $GLOBALS['db']->autoExecute(DB_PREFIX . "deal_dp_point_result", $point_data, "INSERT");
            }
            //创建优惠券点评数据
            if ($dp_data['youhui_id'] > 0) {
                $point_data = array();
                $point_data['group_id'] = $group_id;
                $point_data['dp_id'] = $dp_id;
                $point_data['youhui_id'] = $dp_data['youhui_id'];
                $point_data['point'] = $point;
                $GLOBALS['db']->autoExecute(DB_PREFIX . "youhui_dp_point_result", $point_data, "INSERT");
            }
            //创建活动点评数据
            if ($dp_data['event_id'] > 0) {
                $point_data = array();
                $point_data['group_id'] = $group_id;
                $point_data['dp_id'] = $dp_id;
                $point_data['event_id'] = $dp_data['event_id'];
                $point_data['point'] = $point;
                $GLOBALS['db']->autoExecute(DB_PREFIX . "event_dp_point_result", $point_data, "INSERT");
            }
        }
        //创建点评分组的标签
        foreach ($tag_group as $group_id => $tag_row_arr) {
            foreach ($tag_row_arr as $tag_row) {
                $tag_row_data = array();
                $tag_row_data['tags'] = $tag_row;
                $tag_row_data['dp_id'] = $dp_id;
                $tag_row_data['supplier_location_id'] = $supplier_location_id;
                $tag_row_data['group_id'] = $group_id;
                $GLOBALS['db']->autoExecute(DB_PREFIX . "supplier_location_dp_tag_result", $tag_row_data, "INSERT");
                insert_match_item($tag_row, "supplier_location_dp", $dp_id, "tags_match");
                //更新点评的索引
                review_supplier_location_match($supplier_location_id, $tag_row, $group_id);
                //创建商品点评数据
                if ($dp_data['deal_id'] > 0) {
                    $tag_row_data = array();
                    $tag_row_data['tags'] = $tag_row;
                    $tag_row_data['dp_id'] = $dp_id;
                    $tag_row_data['deal_id'] = $dp_data['deal_id'];
                    $tag_row_data['group_id'] = $group_id;
                    $GLOBALS['db']->autoExecute(DB_PREFIX . "deal_dp_tag_result", $tag_row_data, "INSERT");
                }
                //创建优惠券点评数据
                if ($dp_data['youhui_id'] > 0) {
                    $tag_row_data = array();
                    $tag_row_data['tags'] = $tag_row;
                    $tag_row_data['dp_id'] = $dp_id;
                    $tag_row_data['youhui_id'] = $dp_data['youhui_id'];
                    $tag_row_data['group_id'] = $group_id;
                    $GLOBALS['db']->autoExecute(DB_PREFIX . "youhui_dp_tag_result", $tag_row_data, "INSERT");
                }
                //创建活动点评数据
                if ($dp_data['event_id'] > 0) {
                    $tag_row_data = array();
                    $tag_row_data['tags'] = $tag_row;
                    $tag_row_data['dp_id'] = $dp_id;
                    $tag_row_data['event_id'] = $dp_data['event_id'];
                    $tag_row_data['group_id'] = $group_id;
                    $GLOBALS['db']->autoExecute(DB_PREFIX . "event_dp_tag_result", $tag_row_data, "INSERT");
                }
            }
        }
        //更新统计
        syn_supplier_locationcount($supplier_info);
        cache_store_point($supplier_info['id']);
        //统计商品点评数据
        if ($dp_data['deal_id'] > 0) {
            //计算总点评1-5星人数
            $item_data = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal where id = " . $dp_data['deal_id']);
            $sql = "select count(*) as total,point from " . DB_PREFIX . "supplier_location_dp  where deal_id = " . $item_data['id'] . " group by point ";
            $data_result = $GLOBALS['db']->getAll($sql);
            foreach ($data_result as $k => $v) {
                $item_data['dp_count_' . $v['point']] = $v['total'];
            }
            $GLOBALS['db']->autoExecute(DB_PREFIX . "deal", $item_data, "UPDATE", " id = " . $item_data['id'] . " ");
            syn_deal_review_count($item_data['id']);
        }
        //创建优惠券点评数据
        if ($dp_data['youhui_id'] > 0) {
            //计算总点评1-5星人数
            $item_data = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "youhui where id = " . $dp_data['youhui_id']);
            $sql = "select count(*) as total,point from " . DB_PREFIX . "supplier_location_dp  where youhui_id = " . $item_data['id'] . " group by point ";
            $data_result = $GLOBALS['db']->getAll($sql);
            foreach ($data_result as $k => $v) {
                $item_data['dp_count_' . $v['point']] = $v['total'];
            }
            $GLOBALS['db']->autoExecute(DB_PREFIX . "youhui", $item_data, "UPDATE", " id = " . $item_data['id'] . " ");
            syn_youhui_review_count($item_data['id']);
        }
        //创建活动点评数据
        if ($dp_data['event_id'] > 0) {
            //计算总点评1-5星人数
            $item_data = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "event where id = " . $dp_data['event_id']);
            $sql = "select count(*) as total,point from " . DB_PREFIX . "supplier_location_dp where event_id = " . $item_data['id'] . " group by point ";
            $data_result = $GLOBALS['db']->getAll($sql);
            foreach ($data_result as $k => $v) {
                $item_data['dp_count_' . $v['point']] = $v['total'];
            }
            $GLOBALS['db']->autoExecute(DB_PREFIX . "event", $item_data, "UPDATE", " id = " . $item_data['id'] . " ");
            syn_event_review_count($item_data['id']);
        }
        $return['location_id'] = $supplier_location_id;
        $return['deal_id'] = $dp_data['deal_id'];
        $return['youhui_id'] = $dp_data['youhui_id'];
        $return['event_id'] = $dp_data['event_id'];
        $return['status'] = 1;
        $return['info'] = "发表成功";
        return $return;
    } else {
        $return['status'] = 0;
        $return['info'] = "数据库异常,提交失败";
        return $return;
    }
}
예제 #20
0
 /**
  * 加载报名弹出项
  */
 public function load_event_submit()
 {
     global_run();
     if (check_save_login() == LOGIN_STATUS_NOLOGIN) {
         $data['status'] = 1000;
         ajax_return($data);
     }
     $event_id = intval($_REQUEST['id']);
     require_once APP_ROOT_PATH . "system/model/event.php";
     $event = get_event($event_id);
     if (!$event) {
         $data['status'] = 0;
         $data['info'] = "活动不存在";
         ajax_return($data);
     }
     if ($event['submit_begin_time'] > NOW_TIME) {
         $data['status'] = 0;
         $data['info'] = "活动报名未开始";
         ajax_return($data);
     }
     if ($event['submit_end_time'] > 0 && $event['submit_end_time'] < NOW_TIME) {
         $data['status'] = 0;
         $data['info'] = "活动报名已结束";
         ajax_return($data);
     }
     if ($event['submit_count'] >= $event['total_count'] && $event['total_count'] > 0) {
         $data['status'] = 0;
         $data['info'] = "活动名额已满";
         ajax_return($data);
     }
     $GLOBALS['tmpl']->assign("event_id", $event_id);
     $user_id = intval($GLOBALS['user_info']['id']);
     $user_submit = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "event_submit where user_id = " . $user_id . " and event_id = " . $event_id);
     if ($user_submit) {
         if ($user_submit['is_verify'] == 1) {
             $data['status'] = 0;
             $data['info'] = "您已经报名";
             ajax_return($data);
         } else {
             $event_fields = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "event_field where event_id = " . $event_id . " order by sort asc");
             foreach ($event_fields as $k => $v) {
                 $event_fields[$k]['result'] = $GLOBALS['db']->getOne("select result from " . DB_PREFIX . "event_submit_field where submit_id = " . $user_submit['id'] . " and field_id = " . $v['id'] . " and event_id = " . $event_id);
                 $event_fields[$k]['value_scope'] = explode(" ", $v['value_scope']);
             }
             $GLOBALS['tmpl']->assign("event_fields", $event_fields);
             $GLOBALS['tmpl']->assign("user_submit", $user_submit);
             //表示修改已报名记录
             $GLOBALS['tmpl']->assign("btn_name", "修改报名");
         }
     } else {
         $event_fields = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "event_field where event_id = " . $event_id . " order by sort asc");
         foreach ($event_fields as $k => $v) {
             $event_fields[$k]['value_scope'] = explode(" ", $v['value_scope']);
         }
         $GLOBALS['tmpl']->assign("event_fields", $event_fields);
         $GLOBALS['tmpl']->assign("btn_name", "立即报名");
     }
     $data['status'] = 1;
     $data['html'] = $GLOBALS['tmpl']->fetch("inc/event_submit.html");
     ajax_return($data);
 }
예제 #21
0
                $app->delete('', $check_token_exists, function ($calendar_id, $username) {
                    delete_member($username, $calendar_id);
                });
            });
        });
        $app->group('/events', function () use($app) {
            global $check_token_exists;
            global $decode_body;
            $app->get('', $check_token_exists, function ($calendar_id) {
                get_events($calendar_id);
            });
            $app->post('', $check_token_exists, $decode_body, function ($calendar_id) {
                create_event($calendar_id);
            });
            $app->group('/:event_id', function () use($app) {
                global $check_token_exists;
                global $decode_body;
                $app->get('', $check_token_exists, function ($calendar_id, $event_id) {
                    get_event($calendar_id, $event_id);
                });
                $app->put('', $check_token_exists, $decode_body, function ($calendar_id, $event_id) {
                    edit_event($calendar_id, $event_id);
                });
                $app->delete('', $check_token_exists, function ($calendar_id, $event_id) {
                    delete_event($calendar_id, $event_id);
                });
            });
        });
    });
});
$app->run();
예제 #22
0
function get_event_calendar()
{
    $parser = new Parser();
    if (isset($_GET['mon'])) {
        $mon = $_GET['mon'];
        if ($_GET['mon'] == 13) {
            $mon = 1;
        }
        if ($_GET['mon'] == 0) {
            $mon = 12;
        }
        $calendar = all_calendar($mon);
    } else {
        $calendar = all_calendar();
        $a = getdate();
        $mon = $a['mon'];
    }
    $nameMon = name_mon($mon);
    $event = get_event($mon);
    $parser->parse(TM_DIR . '/views/events/all_events.php', ['calendar' => $calendar, 'event' => $event, 'namemon' => $nameMon], TRUE);
}
예제 #23
0
<?php

require 'connection.php';
session_start();
$eid = $_GET['id'];
$event = get_event($eid);
$img = get_img($eid);
$mem = members($eid);
if (isset($_SESSION['username'])) {
    $user = $_SESSION['username'];
} else {
    $user = NULL;
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no"/>
  <title>Eventize</title>
  <link rel="stylesheet" type="text/css" href="assets/css/keyframes.css">
   <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
  <link rel="stylesheet" type="text/css" href="assets/css/pageTransitions.css">
  <script src="assets/js/jquery.smoothState.js"></script>
  <script src="asset/js/functions.js"></script>
  <script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
  <script src="assets/js/materialize.js"></script>
  <script src="assets/js/init.js"></script>
  <style type="text/css">
  </style>
  <link href="assets/css/materialize.css" type="text/css" rel="stylesheet" media="screen,projection"/>
예제 #24
0
<?php

include_once "header.php";
/* 連資料庫檢查 */
echo get_event();
//取得事件
function get_event()
{
    global $xoopsDB, $xoopsUser, $xoopsModuleConfig;
    $cate_sn = intval($_REQUEST['cate_sn']);
    //取得目前使用者可讀的群組
    $ok_cate_arr = chk_tad_cal_cate_power('enable_group');
    $all_ok_cate = implode(",", $ok_cate_arr);
    $and_ok_cate = empty($all_ok_cate) ? "and cate_sn='0'" : "and cate_sn in({$all_ok_cate})";
    $and_ok_cate2 = empty($all_ok_cate) ? "and a.sn='0'" : "and b.cate_sn in({$all_ok_cate})";
    $even_start = date("Y-m-d H:i", $_REQUEST['start'] / 1000);
    $even_end = $_REQUEST['end'] == "0000-00-00 00:00" ? "" : date("Y-m-d H:i", $_REQUEST['end'] / 1000);
    $and_cate_sn = empty($cate_sn) ? "" : "and `cate_sn` = '{$cate_sn}'";
    $and_cate_sn2 = empty($cate_sn) ? "" : "and b.`cate_sn` = '{$cate_sn}'";
    //抓出事件
    $sql = "select * from " . $xoopsDB->prefix("tad_cal_event") . " where `start` >= '{$even_start}' and `end` <= '{$even_end}' {$and_ok_cate} {$and_cate_sn} order by `start` , `sequence`";
    //die($sql);
    $result = $xoopsDB->query($sql) or web_error($sql);
    $i = 0;
    while ($all = $xoopsDB->fetchArray($result)) {
        //以下會產生這些變數: $sn , $title , $start , $end , $recurrence , $location , $kind , $details , $etag , $id , $sequence , $uid , $cate_sn
        foreach ($all as $k => $v) {
            ${$k} = $v;
        }
        if (!empty($recurrence)) {
            continue;
예제 #25
0
 public function index()
 {
     $type = strim($GLOBALS['request']['type']);
     $id = intval($GLOBALS['request']['id']);
     $city_name = strim($GLOBALS['request']['city_name']);
     //城市名称
     $deal_id = 0;
     $youhui_id = 0;
     $location_id = 0;
     $event_id = 0;
     $tech_id = 0;
     if ($type == "deal") {
         $deal_id = $id;
         require_once APP_ROOT_PATH . "system/model/deal.php";
         $deal_info = get_deal($deal_id);
         $relate_data_name = $deal_info['name'];
     } elseif ($type == "supplier") {
         $location_id = $id;
         require_once APP_ROOT_PATH . "system/model/supplier.php";
         $location_info = get_location($location_id);
         $relate_data_name = $location_info['name'];
     } elseif ($type == "youhui") {
         $youhui_id = $id;
         require_once APP_ROOT_PATH . "system/model/youhui.php";
         $youhui_info = get_youhui($youhui_id);
         $relate_data_name = $youhui_info['name'];
     } elseif ($type == "event") {
         $event_id = $id;
         require_once APP_ROOT_PATH . "system/model/event.php";
         $event_info = get_event($event_id);
         $relate_data_name = $event_info['name'];
     } elseif ($type == "tech") {
         $tech_id = $id;
         require_once APP_ROOT_PATH . "system/model/tech.php";
         $tech_info = get_tech($tech_id);
         $relate_data_name = $tech_info['name'];
     }
     $page = intval($GLOBALS['request']['page']);
     /*分页*/
     $city_name = strim($GLOBALS['request']['city_name']);
     //城市分类ID
     //检查用户,用户密码
     $user = $GLOBALS['user_info'];
     $user_id = intval($user['id']);
     $root = array();
     $root['return'] = 1;
     $page = $page == 0 ? 1 : $page;
     $page_size = PAGE_SIZE;
     $limit = ($page - 1) * $page_size . "," . $page_size;
     // 		$message_re=m_get_message_list($limit," m.rel_table = 'deal' and m.rel_id=".$tuan_id." and m.is_buy = 1",0);/*购买评论*/
     require_once APP_ROOT_PATH . "system/model/review.php";
     require_once APP_ROOT_PATH . "system/model/user.php";
     $message_re = get_dp_list($limit, $param = array("deal_id" => $deal_id, "youhui_id" => $youhui_id, "event_id" => $event_id, "location_id" => $location_id, "tech_id" => $tech_id, "tag" => ""), "", "");
     foreach ($message_re['list'] as $k => $v) {
         $message_re['list'][$k]['width'] = $v['point'] / 5 * 100;
         $message_re['list'][$k]['create_time'] = to_date($v['create_time']);
         $uinfo = load_user($v['user_id']);
         $message_re['list'][$k]['user_name'] = $uinfo['user_name'];
         foreach ($message_re['list'][$k]['images'] as $kk => $vv) {
             $message_re['list'][$k]['images'][$kk] = get_abs_img_root(get_spec_image($vv, 60, 60, 1));
             $message_re['list'][$k]['oimages'][$kk] = get_abs_img_root($vv);
         }
     }
     $root['message_list'] = $message_re['list'];
     if (count($message_re['list']) > 0) {
         $sql = "select count(*) from " . DB_PREFIX . "supplier_location_dp where  " . $message_re['condition'];
         $message_re['count'] = $GLOBALS['db']->getOne($sql);
     }
     $root['message_count'] = $message_re['count'];
     //$deal = get_deal($tuan_id);
     $dp_info = load_dp_info(array("deal_id" => $deal_id, "youhui_id" => $youhui_id, "event_id" => $event_id, "location_id" => $location_id, "tech_id" => $tech_id));
     $root['name'] = $relate_data_name;
     //星级点评数
     $root['star_1'] = $dp_info['dp_count_1'];
     $root['star_2'] = $dp_info['dp_count_2'];
     $root['star_3'] = $dp_info['dp_count_3'];
     $root['star_4'] = $dp_info['dp_count_4'];
     $root['star_5'] = $dp_info['dp_count_5'];
     $root['star_dp_width_1'] = $dp_info['avg_point_1_percent'];
     $root['star_dp_width_2'] = $dp_info['avg_point_2_percent'];
     $root['star_dp_width_3'] = $dp_info['avg_point_3_percent'];
     $root['star_dp_width_4'] = $dp_info['avg_point_4_percent'];
     $root['star_dp_width_5'] = $dp_info['avg_point_5_percent'];
     $buy_dp_sum = 0.0;
     // 		$buy_dp_group = $GLOBALS['db']->getAll("select point,count(*) as num from ".DB_PREFIX."message where rel_id = ".$tuan_id." and rel_table = 'deal' and pid = 0 and is_buy = 1 group by point");
     // 		foreach($buy_dp_group as $dp_k=>$dp_v)
     // 		{
     // 			$star = intval($dp_v['point']);
     // 			if ($star >= 1 && $star <= 5){
     // 				$root['star_'.$star] = $dp_v['num'];
     // 				$buy_dp_sum += $star * $dp_v['num'];
     // 				$root['star_dp_width_'.$star] = (round($dp_v['num']/ $message_re['count'],1)) * 100;
     // 			}
     // 		}
     //点评平均分
     $root['buy_dp_sum'] = $dp_info['dp_count'];
     $root['buy_dp_avg'] = $dp_info['avg_point'];
     $root['buy_dp_width'] = $dp_info['avg_point'] / 5 * 100;
     $page_total = ceil($message_re['count'] / $page_size);
     $root['page'] = array("page" => $page, "page_total" => $page_total, "page_size" => $page_size);
     $root['allow_dp'] = 0;
     //0:不允许点评;1:允许点评
     //判断用户是否购买了这个商品
     if ($user_id > 0) {
         // 			$sql = "select count(*) from ".DB_PREFIX."deal_order_item as doi left join ".DB_PREFIX."deal_order as do on doi.order_id = do.id where doi.deal_id = ".intval($tuan_id)." and do.user_id = ".intval($user_id)." and do.pay_status = 2";
         // 			//$root['sql'] = $sql;
         // 			if($GLOBALS['db']->getOne($sql)>0)
         // 			{
         // 				$root['allow_dp'] = 1;
         // 			}
         $dp_status = check_dp_status($user_id, array("deal_id" => $deal_id, "youhui_id" => $youhui_id, "event_id" => $event_id, "location_id" => $location_id));
         if ($dp_status['status']) {
             $root['allow_dp'] = 1;
         }
         if ($type == "tech" && $user_id == $id) {
             //技师本身不能给自己点评
             $root['allow_dp'] = 0;
         }
     }
     $root['type'] = $type;
     $root['id'] = $id;
     $root['page_title'] = "点评列表";
     $root['city_name'] = $city_name;
     output($root);
 }
예제 #26
0
 public function index()
 {
     require_once APP_ROOT_PATH . "system/model/user.php";
     if (strim($GLOBALS['request']['act_2']) == 'bm') {
         $root['status'] = 1;
         $city_name = strim($GLOBALS['request']['city_name']);
         //城市名称
         //检查用户,用户密码
         $user_data = $GLOBALS['user_info'];
         //报名
         if ($user_data) {
             $root['user_login_status'] = 1;
             $event_id = intval($GLOBALS['request']['event_id']);
             $user_id = intval($GLOBALS['user_info']['id']);
             require_once APP_ROOT_PATH . "system/model/event.php";
             // 				$event = $GLOBALS['db']->getRow("select * from ".DB_PREFIX."event where id = ".$event_id." and is_effect = 1");
             $event = get_event($event_id);
             if ($event) {
                 if ($event['xpoint'] == '') {
                     $event['xpoint'] = 0;
                 }
                 if ($event['ypoint'] == '') {
                     $event['ypoint'] = 0;
                 }
                 if ($event['submit_begin_time'] > NOW_TIME) {
                     $root['return'] = 0;
                     $root['info'] = "活动未开始";
                 } elseif ($event['submit_end_time'] > 0 && $event['submit_end_time'] < NOW_TIME) {
                     $root['return'] = 0;
                     $root['info'] = "活动报名已结束";
                 } elseif ($event['submit_count'] >= $event['total_count'] && $event['total_count'] > 0) {
                     $root['return'] = 0;
                     $root['info'] = "活动名额已满";
                 } else {
                     //开始提交报名
                     $user_id = intval($GLOBALS['user_info']['id']);
                     $user_submit = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "event_submit where user_id = " . $user_id . " and event_id = " . $event_id);
                     if ($user_submit) {
                         if ($user_submit['is_verify'] == 1) {
                             $root['return'] = 0;
                             $root['info'] = "您已经报过名了";
                         } elseif ($user_submit['is_verify'] == 2) {
                             $root['return'] = 0;
                             $root['info'] = "您的报名审核不通过";
                         } else {
                             //已经报名,仅作修改
                             $bm = $GLOBALS['request']['bm'];
                             $GLOBALS['db']->query("delete from " . DB_PREFIX . "event_submit_field where submit_id = " . $user_submit['id']);
                             foreach ($bm as $field_id => $bm_result) {
                                 $field_data = array();
                                 $field_data['submit_id'] = $user_submit['id'];
                                 $field_data['field_id'] = $field_id;
                                 $field_data['event_id'] = $event_id;
                                 $field_data['result'] = strim($bm_result);
                                 $GLOBALS['db']->autoExecute(DB_PREFIX . "event_submit_field", $field_data, "INSERT");
                             }
                             $root['return'] = 1;
                             $root['info'] = "报名修改成功";
                         }
                     } else {
                         $submit_data = array();
                         $submit_data['user_id'] = $user_id;
                         $submit_data['event_id'] = $event_id;
                         $submit_data['create_time'] = get_gmtime();
                         $GLOBALS['db']->autoExecute(DB_PREFIX . "event_submit", $submit_data, "INSERT");
                         $submit_id = $GLOBALS['db']->insert_id();
                         if ($submit_id) {
                             $bm = $GLOBALS['request']['bm'];
                             //file_put_contents(APP_ROOT_PATH. "sjmapi/log/bm_".strftime("%Y%m%d%H%M%S",time()).".txt",print_r($GLOBALS['request'],true));
                             //$bm = (unserialize($GLOBALS['request']['bm']));
                             foreach ($bm as $field_id => $bm_result) {
                                 $field_data = array();
                                 $field_data['submit_id'] = $submit_id;
                                 $field_data['field_id'] = $field_id;
                                 $field_data['event_id'] = $event_id;
                                 $field_data['result'] = strim($bm_result);
                                 $GLOBALS['db']->autoExecute(DB_PREFIX . "event_submit_field", $field_data, "INSERT");
                             }
                             $GLOBALS['db']->query("update " . DB_PREFIX . "event set submit_count = submit_count+1 where id=" . $event_id);
                             if ($event['is_auto_verify'] == 1) {
                                 //自动审核,发券
                                 $sn = verify_event_submit($submit_id);
                             }
                             //同步分享
                             // 								$title = "报名参加了".$event['name'];
                             // 								$content = "报名参加了".$event['name']." - ".$event['brief'];
                             // 								$url_route = array(
                             // 										'rel_app_index'	=>	'youhui',
                             // 										'rel_route'	=>	'edetail',
                             // 										'rel_param' => 'id='.$event['id']
                             // 								);
                             // 								$tid = insert_topic($content,$title,$type="eventsubmit",$group="", $relay_id = 0, $fav_id = 0,$group_data ="",$attach_list=array(),$url_route);
                             // 								if($tid)
                             // 								{
                             // 									$GLOBALS['db']->query("update ".DB_PREFIX."topic set source_name = '".$GLOBALS['request']['source']."' where id = ".intval($tid));
                             // 								}
                             //同步分享
                             $title = "报名参加了" . $event['name'];
                             $content = "报名参加了" . $event['name'] . " - " . $event['brief'];
                             $url_route = array('rel_app_index' => 'index', 'rel_route' => 'event#' . $event['id'], 'rel_param' => '');
                             require_once APP_ROOT_PATH . "system/model/topic.php";
                             $tid = insert_topic($content, $title, $type = "eventsubmit", $group = "", $relay_id = 0, $fav_id = 0, $group_data = "", $attach_list = array(), $url_route);
                             if ($tid) {
                                 $GLOBALS['db']->query("update " . DB_PREFIX . "topic set source_name = '" . $GLOBALS['request']['source'] . "' where id = " . intval($tid));
                             }
                             require_once APP_ROOT_PATH . "system/model/user.php";
                             modify_account(array("score" => "-" . $event['score_limit']), $user_id, "活动报名:" . $event['name']);
                             $root['return'] = 1;
                             $root['info'] = "报名成功";
                             if ($sn) {
                                 $root['info'] .= " 验证码:" . $sn;
                             } else {
                                 $root['info'] .= " 请等待审核";
                             }
                             rm_auto_cache("event", array("id" => $event['id']));
                         } else {
                             $root['return'] = 0;
                             $root['info'] = "报名失败";
                         }
                     }
                 }
             } else {
                 $root['return'] = 0;
                 $root['info'] = "没有该活动数据";
             }
         } else {
             $root['return'] = 0;
             $root['user_login_status'] = 0;
             $root['info'] = "请先登录";
         }
         output($root);
         //报名
     }
     //报名结束
     $page = intval($GLOBALS['request']['page']);
     //分页,无用
     if ($page == 0) {
         $page = 1;
     }
     $event_id = intval($GLOBALS['request']['event_id']);
     if ($event_id) {
         $user_data = $GLOBALS['user_info'];
         require_once APP_ROOT_PATH . "system/model/event.php";
         $event = get_event($event_id);
         if ($event['xpoint'] == '') {
             $event['xpoint'] = 0;
         }
         if ($event['ypoint'] == '') {
             $event['ypoint'] = 0;
         }
         $pattern = "/<img([^>]*)\\/>/i";
         $replacement = "<img width=300 \$1 />";
         $event['icon'] = get_abs_img_root($event['icon']);
         $pattern = "/<[img|IMG].*?src=[\\'|\"](.*?(?:[\\.gif|\\.jpg|\\.png]))[\\'|\"].*?[\\/]?>/i";
         //$replacement = "<img width=300 $1 />";
         $replacement = "<img src='\$1' width='278' />";
         $event['content'] = get_abs_img_root(preg_replace($pattern, $replacement, $event['content']));
         //$event['content'] = get_abs_img_root(get_spec_image($event['content'], 278,168,1));
         $event['content'] = preg_replace($pattern, $replacement, $event['content']);
         $event['event_begin_time'] = to_date($event['event_begin_time'], 'Y-m-d');
         $event['event_end_time'] = to_date($event['event_end_time'], 'Y-m-d');
         //验证是否报名
         //$is_submit = $GLOBALS['db']->getOne("select count(*) from ".DB_PREFIX."event_submit where user_id = ".intval($GLOBALS['user_info']['id'])." and event_id = ".$event['id']);
         // 			$event_fields = $GLOBALS['db']->getAll("select * from ".DB_PREFIX."event_field where event_id = ".$event_id." order by sort asc");
         // 			foreach($event_fields as $k=>$v)
         // 			{
         // 				$event_fields[$k]['value_scope'] = explode(" ",$v['value_scope']);
         // 			}
         // 			$event['field_list'] = $event_fields;
         // 			$event['is_submit'] = $is_submit;
         // 			$event['field_list_json']=json_encode($event_fields);
         $user_submit = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "event_submit where user_id = " . $user_data['id'] . " and event_id = " . $event_id);
         if ($user_submit) {
             if ($user_submit['is_verify'] == 1) {
                 $event['is_submit'] = 1;
                 //已报名
                 $event['is_verify'] = 1;
                 //已审核
             } elseif ($user_submit['is_verify'] == 2) {
                 $event['is_submit'] = 1;
                 //已报名
                 $event['is_verify'] = 2;
                 //审核失败
             } else {
                 //未审核
                 $event_fields = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "event_field where event_id = " . $event_id . " order by sort asc");
                 foreach ($event_fields as $k => $v) {
                     $event_fields[$k]['result'] = $GLOBALS['db']->getOne("select result from " . DB_PREFIX . "event_submit_field where submit_id = " . $user_submit['id'] . " and field_id = " . $v['id'] . " and event_id = " . $event_id);
                     $event_fields[$k]['value_scope'] = explode(" ", $v['value_scope']);
                 }
                 $event['event_fields'] = $event_fields;
                 $event['is_submit'] = 1;
                 //已报名
                 $event['is_verify'] = 0;
                 //未审核
                 // 					$GLOBALS['tmpl']->assign("event_fields",$event_fields);
                 // 					$GLOBALS['tmpl']->assign("user_submit",$user_submit);  //表示修改已报名记录
                 // 					$GLOBALS['tmpl']->assign("btn_name","修改报名");
             }
         } else {
             $event_fields = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "event_field where event_id = " . $event_id . " order by sort asc");
             foreach ($event_fields as $k => $v) {
                 $event_fields[$k]['value_scope'] = explode(" ", $v['value_scope']);
             }
             $event['event_fields'] = $event_fields;
             $event['is_submit'] = 0;
             //已报名
         }
     }
     //$res = m_get_event_reply($event_id,$page);
     //$event['comments'] =  $res['list'];
     //$root['page'] = $res['page'];
     require_once APP_ROOT_PATH . "system/model/review.php";
     require_once APP_ROOT_PATH . "system/model/user.php";
     $message_re = get_dp_list(3, $param = array("deal_id" => 0, "youhui_id" => 0, "event_id" => $event_id, "location_id" => 0, "tag" => ""), "", "");
     foreach ($message_re['list'] as $k => $v) {
         $message_re['list'][$k]['width'] = $v['point'] / 5 * 100;
         $uinfo = load_user($v['user_id']);
         $message_re['list'][$k]['user_name'] = $uinfo['user_name'];
         foreach ($message_re['list'][$k]['images'] as $kk => $vv) {
             $message_re['list'][$k]['images'][$kk] = get_abs_img_root(get_spec_image($vv, 60, 60, 1));
             $message_re['list'][$k]['oimages'][$kk] = get_abs_img_root($vv);
         }
     }
     $root['message_list'] = $message_re['list'];
     if (count($message_re['list']) > 0) {
         $sql = "select count(*) from " . DB_PREFIX . "supplier_location_dp where  " . $message_re['condition'];
         $message_re['count'] = $GLOBALS['db']->getOne($sql);
     }
     $root['message_count'] = $message_re['count'];
     $root['return'] = 1;
     $root['item'] = $event;
     $root['page_title'] = "活动详情";
     $root['city_name'] = $city_name;
     output($root);
 }