function get_info($sid, $type) { $url = 'http://www.xiami.com/song/playlist/id/' . $sid . '/type/' . $type; $useCookie = $type == 9 ? 1 : null; $result = curl_http($url, $useCookie); $data = array(); if ($result) { $res = str_replace(array('<![CDATA[', ']]>'), array('', ''), $result); if ($res == $result) { $data['info'] = '请使用国内代理!'; return $data; } $res = preg_replace('/&(?!#?[a-z0-9]+;)/', '&', $res); $xml = simplexml_load_string($res); $arr = json_decode(json_encode($xml), true); $html = ''; $track = $arr['trackList']['track']; $close = '<div class="close" title="关闭">×</div>'; if ($type == 0) { $song = 'http://www.xiami.com/song/gethqsong/sid/' . $sid; $json = curl_http($song, 1); $location = $json ? json_decode($json)->location : ''; $location = $json ? $json['trackList']['track']['location'] : ''; if ($location) { $data['src'] = get_location($location); $data['status'] = 1; } else { $data['info'] = '获取歌曲链接失败!'; return $data; } $html = '<div class="info-item"><img src="' . $track['pic'] . '"><div><strong>标题:</strong>' . $track['songName'] . '</div><div><strong>艺人:</strong>' . _a($track['artist'], $track['artist_id'], 'artist') . '</div>'; $html .= is_string($track['album_name']) ? '<div><strong>专辑:</strong>' . _a($track['album_name'], $track['album_id'], 'album') . '</div>' : ''; $html .= is_string($track['lyric']) ? '<div><strong>歌词:</strong>' . $track['lyric'] . '</div>' : ''; $html .= '<strong id="song">歌曲:</strong><div id="case"><label id="case-label"><input id="src" onmouseover="this.select()" value="' . $data['src'] . '"></label></div>'; $html .= $close . '</div>'; } else { $title = $type == 3 ? '精选集曲目:' : '今日歌单曲目:'; $html = '<div class="info-item">'; $html .= $type == 1 ? '<img src="' . $track[0]['pic'] . '"><div><strong>专辑:</strong>' . $track[0]['album_name'] . '</div><div><strong>艺人:</strong>' . _a($track[0]['artist'], $track[0]['artist_id'], 'artist') : ''; $html .= $type == 2 ? '<div><strong>' . $track[0]['artist'] . '的热门曲目:</strong>' : ''; $html .= $type == 3 || $type == 9 ? '<div><strong>' . $title . '</strong>' : ''; $html .= '</div><ol>'; foreach ($track as $item) { $html .= '<li>' . _a($item['songName'], $item['song_id'], 'song'); $html .= $type == 3 || $type == 9 ? ' - ' . _a($item['artist'], $item['artist_id'], 'artist') : ''; if ($type != 1) { $html .= ' - 《' . _a($item['album_name'], $item['album_id'], 'album') . '》'; } $html .= '</li>'; } $html .= '</ol>' . $close . '</div>'; $data['status'] = 1; } $data['info'] = htmlspecialchars($html); } else { $data['info'] = '解析失败!'; } return $data; }
function delete_move_next_read($currloc) { global $delete_move_next_formATtop, $delete_move_next_formATbottom; global $color, $where, $what, $currentArrayIndex, $passed_id; global $urlMailbox, $sort, $startMessage, $delete_id, $move_id; global $imapConnection; if ($where && $what || $currentArrayIndex == -1) { return; } else { $next = findNextMessage(); if ($next == -1) { return; } } $location = get_location(); echo "<base href=\"{$location}/\">"; ?> <table cols=1 cellspacing=0 width=100% border=0 cellpadding=2> <tr> <td bgcolor="<?php echo $color[9]; ?> " width=100% align=center><small> <?php $prev = findPreviousMessage(); if ($prev != -1) { echo "<a href=\"read_body.php?passed_id={$prev}&mailbox={$urlMailbox}&sort={$sort}&startMessage={$startMessage}&show_more=0\">" . _("Previous") . "</A> | "; } else { echo _("Previous") . " | "; } echo "<a href=\"read_body.php?passed_id={$next}&mailbox={$urlMailbox}&sort={$sort}&startMessage={$startMessage}&show_more=0\">" . _("Next") . "</a> | "; if ($prev != -1) { echo "<a href=\"read_body.php?passed_id={$passed_id}&mailbox={$urlMailbox}&sort={$sort}&startMessage={$startMessage}&show_more=0&delete_id={$passed_id}\">" . _("Delete & Prev") . "</a>" . " | "; } else { echo _("Delete & Prev") . " | "; } echo "<a href=\"read_body.php?passed_id={$next}&mailbox={$urlMailbox}&sort={$sort}&startMessage={$startMessage}&show_more=0&delete_id={$passed_id}\">" . _("Delete & Next") . "</a>"; ?> </small></td> </tr> <?php if ($delete_move_next_formATtop == "on" && $currloc == "top") { delete_move_next_moveForm($next); } if ($delete_move_next_formATbottom != "off" && $currloc == "bottom") { delete_move_next_moveForm($next); } ?> </table><?php }
public function main() { if (function_exists('gd_info')) { $gd = gd_info(); $gd = $gd['GD Version']; } else { $gd = "不支持"; } $system_info = array('0' => PHP_OS, '1' => php_sapi_name(), '2' => function_exists("mysql_close") ? mysql_get_client_info() : '不支持', '3' => PHP_VERSION, '4' => ini_get('upload_max_filesize'), '5' => $gd); $this->assign('system_info', $system_info); $this->assign('area', get_location($_SESSION['user_info']['last_login_ip'])); $this->assign('user_info', $_SESSION['user_info']); $this->display('Admin:main'); }
function save_to_database($res) { $mysqli = new mysqli('localhost', 'root', '', 'events'); //DB connection error if (static::$mysqli->connect_errno) { echo_error(DB_CONNECTION_ERROR); return; } foreach ($arr as $item) { $start_end_time = get_start_end_timestamp($item['date'], $item['time']); $loc = get_location($item['location']); $res = $mysqli->query("INSERT INTO events VALUES({$item['event_id']}, {$item['event_title']}, {$item['event_subtitle']}, {$start_end_time[0]}), {$start_end_time[1]}, {$loc}, {$item['page_url']}, {$item['img_url']}"); // } }
function show_welcome($nick) { $location = get_location($nick); if ($location === False) { return; } $time = get_time($location); if ($time == "") { return; } $arr = convert_google_location_time($time); $data = process_weather($location, $nick, True); if ($data === False) { return; } if ($data["tempC"] === False or $data["tempF"] === False) { return; } privmsg("welcome {$nick}: " . trim($arr["location"]) . ", " . $data["tempC"] . "/" . $data["tempF"] . ", " . date("g:i a", $arr["timestamp"]) . " " . $arr["timezone"] . ", " . date("l, j F Y", $arr["timestamp"])); }
/** * 加载相应的类型消息 * @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; }
private function login($email, $password) { global $con; if (isset($email) && isset($password)) { $loggedin = false; $user_query = mysqli_query($con, "SELECT * FROM usr"); while ($user = mysqli_fetch_array($user_query)) { if (strlen(trim($user["password"])) >= SALT_LEN) { $current_user_salt = return_salt(trim($user["password"])); $given_pw_hashed = hash_password($password, $current_user_salt); if (trim($user["password"]) === trim($given_pw_hashed) && trim($email) === trim($user["email"])) { $loggedin = true; $_SESSION["userid"] = $user["id"]; $userUpdate = new User(array("action" => "update", "fields" => array("last_login" => time(), "active" => "1", "last_location" => json_encode(get_location())))); $userUpdate->run(true); switch (trim($user["status"])) { case 0: return 101; break; case 1: return 102; break; case 2: return 100; break; } } } } if (!$loggedin) { return 0; } } else { return 401; } }
public function get_view($view, $data, $layout = DEFAULT_LAYOUT) { if (isset($data['route_info'])) { $route_info = $data['route_info']; unset($data['route_info']); $data = array_merge($data, $route_info); } if (Dev && \Request::has('debug')) { err($data); } if (Dev && \Request::has('debug-all')) { err(); } $layout = view(get_location("-Layouts.{$layout}.-box"), $data); $view = get_location($view); $view_obj = $layout->nest('content_layout', $view, $data); if (!Dev) { $html = $view_obj->render(); $page = overkill_minify($html); return $page; } // dd($data); return $view_obj; }
if ($rid == $theid) { $temp_rule = $new_rules[$rid - 1]; $new_rules[$rid - 1] = $rule; $new_rules[$rid] = $temp_rule; } else { $new_rules[$rid] = $rule; } } break; default: $new_rules = $message_highlight_list; break; } $message_highlight_list = $new_rules; setPref($data_dir, $username, 'hililist', serialize($message_highlight_list)); header('Location: ' . get_location() . '/options_highlight.php'); exit; } else { if ($action == 'save') { // security check sm_validate_security_token($submitted_token, -1, TRUE); if ($color_type == 1) { $newcolor = $newcolor_choose; } elseif ($color_type == 2) { $newcolor = $newcolor_input; } else { $newcolor = $color_type; } $newcolor = str_replace('#', '', $newcolor); $newcolor = str_replace('"', '', $newcolor); $newcolor = str_replace('\'', '', $newcolor);
if (strpos($emailaddress, '?') !== false) { list($emailaddress, $a) = explode('?', $emailaddress, 2); if (strlen(trim($a)) > 0) { $a = explode('=', $a, 2); $url .= $trtable[strtolower($a[0])] . '=' . urlencode($a[1]) . '&'; } } $url = 'send_to=' . urlencode($emailaddress) . '&' . $url; /* CC, BCC, etc could be any case, so we'll fix them here */ foreach ($_GET as $k => $g) { $k = strtolower($k); if (isset($trtable[$k])) { $k = $trtable[$k]; $url .= $k . '=' . urlencode($g) . '&'; } } $url = substr($url, 0, -1); } sqsession_is_active(); if ($force_login == false && sqsession_is_registered('user_is_logged_in')) { if ($compose_only == true) { $redirect = 'compose.php?' . $url; } else { $redirect = 'webmail.php?right_frame=compose.php?' . urlencode($url); } } else { $redirect = 'login.php?mailto=' . urlencode($url); } session_write_close(); header('Location: ' . get_location() . '/' . $redirect);
?> </strong> <span>Garages</span> </div><!-- /.col-sm-3 --> </div><!-- /.property-row-meta --> </div><!-- /.property-row-picture --> </div><!-- /.property-row-picture --> <div class="property-row-content col-sm-6 col-md-6 col-lg-8"> <h3 class="property-row-title"> <a href="#">9115 Cinder Anchor Limits</a> </h3><!-- /.property-row-title --> <h4 class="property-row-subtitle"> <a href="#"><?php echo get_location(); ?> , 94108</a> </h4><!-- /.property-row-subtitle --> <div class="property-row-price"><?php echo get_price(); ?> </div><!-- /.property-row-price --> <p class="property-row-body"> In facilisis sem id quam dictum laoreet. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nullam fermentum urna nec bibendum hendrerit. Mauris nec ante sapien. </p><!-- /.property-row-body --> </div><!-- /.property-row-content --> </div><!-- /.row --> </div><!-- /.property-row -->
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); }
public function providerTripChangeState() { $date = date("Y-m-d H:i:s"); $time_limit = date("Y-m-d H:i:s", strtotime($date) - 3 * 60 * 60); $walker_id = Session::get('walker_id'); $state = $request_id = Request::segment(4); $current_request = Requests::where('confirmed_walker', $walker_id)->where('is_cancelled', 0)->where('is_dog_rated', 0)->where('created_at', '>', $time_limit)->orderBy('created_at', 'desc')->where(function ($query) { $query->where('status', 0)->orWhere(function ($query_inner) { $query_inner->where('status', 1)->where('is_dog_rated', 0); }); })->first(); if ($current_request && $state) { if ($state == 2) { $current_request->is_walker_started = 1; $owner = Owner::find($current_request->owner_id); $walker = Walker::find($walker_id); $location = get_location($owner->latitude, $owner->longitude); $latitude = $location['lat']; $longitude = $location['long']; $angle = get_angle($walker->latitude, $walker->longitude, $latitude, $longitude); $walker->old_latitude = $walker->latitude; $walker->old_longitude = $walker->longitude; $walker->latitude = $latitude; $walker->longitude = $longitude; $walker->bearing = $angle; $walker->save(); $walk_location = new WalkLocation(); $walk_location->request_id = $current_request->id; $walk_location->latitude = $latitude; $walk_location->longitude = $longitude; $walk_location->distance = 0; $walk_location->save(); } if ($state == 3) { $current_request->is_walker_arrived = 1; } if ($state == 4) { $current_request->is_started = 1; } if ($state == 6) { $rating = 0; if (Input::has('rating')) { $rating = Input::get('rating'); } $current_request->is_dog_rated = 1; $current_request->save(); $review_dog = new DogReview(); $review_dog->walker_id = $current_request->confirmed_walker; $review_dog->comment = Input::get('review'); $review_dog->rating = $rating; $review_dog->owner_id = $current_request->owner_id; $review_dog->request_id = $current_request->id; $review_dog->save(); if ($rating) { if ($owner = Owner::find($current_request->owner_id)) { $old_rate = $owner->rate; $old_rate_count = $owner->rate_count; $new_rate_counter = $owner->rate_count + 1; $new_rate = ($owner->rate * $owner->rate_count + $rating) / $new_rate_counter; $owner->rate_count = $new_rate_counter; $owner->rate = $new_rate; $owner->save(); } } $message = "You has successfully rated the owner."; $type = "success"; return Redirect::to('/provider/trips')->with('message', $message)->with('type', $type); } if ($state == 5) { $request_services = RequestServices::where('request_id', $current_request->id)->first(); $request_typ = ProviderType::where('id', '=', $request_services->req_typ)->first(); $address = urlencode(Input::get('address')); $end_address = json_decode(file_get_contents("https://maps.googleapis.com/maps/api/geocode/json?address={$address}"), TRUE); $end_location = $end_address['results'][0]['geometry']; $latitude = $end_location['location']['lat']; $longitude = $end_location['location']['lng']; $location = get_location($latitude, $longitude); $latitude = $location['lat']; $longitude = $location['long']; $request_id = $current_request->id; $walk_location_last = WalkLocation::where('request_id', $request_id)->orderBy('created_at', 'desc')->first(); if ($walk_location_last) { $distance_old = $walk_location_last->distance; $distance_new = distanceGeoPoints($walk_location_last->latitude, $walk_location_last->longitude, $latitude, $longitude); $distance = $distance_old + $distance_new; $settings = Settings::where('key', 'default_distance_unit')->first(); //$unit = $settings->value; $distance = $distance; } else { $distance = 0; } $walker = Walker::find($walker_id); $angle = get_angle($walker->latitude, $walker->longitude, $latitude, $longitude); $walker->old_latitude = $walker->latitude; $walker->old_longitude = $walker->longitude; $walker->latitude = $latitude; $walker->longitude = $longitude; $walker->bearing = $angle; $walker->save(); $walk_location = new WalkLocation(); $walk_location->request_id = $request_id; $walk_location->latitude = $latitude; $walk_location->longitude = $longitude; $walk_location->distance = $distance; $walk_location->save(); Walker::where('id', '=', $walker_id)->update(array('is_available' => 1)); // Calculate Rerquest Stats $time = 0; $time_query = "SELECT TIMESTAMPDIFF(SECOND,MIN(created_at),MAX(created_at)) as diff\n\t\t\t\tFROM walk_location where request_id = {$current_request->id}\n\t\t\t\tGROUP BY request_id limit 1 "; $time_data = DB::select(DB::raw($time_query)); foreach ($time_data as $time_diff) { $time = $time_diff->diff; } $time = $time / 60; /* TIME CALCULATION REDIRECTED */ $time = 0; /* TIME CALCULATION REDIRECTED END */ $walker_data = Walker::find($current_request->confirmed_walker); $provider_type = ProviderServices::where('type', $walker_data->type)->where('provider_id', $walker_id)->first(); if ($provider_type == NULL) { /* $settings = Settings::where('key', 'price_per_unit_distance')->first(); $price_per_unit_distance = $settings->value; $settings = Settings::where('key', 'price_per_unit_time')->first(); $price_per_unit_time = $settings->value; $settings = Settings::where('key', 'base_price')->first(); $base_price = $settings->value; */ $setbase_distance = $request_typ->base_distance; $base_price = $request_typ->base_price; $price_per_unit_distance = $request_typ->price_per_unit_distance; $price_per_unit_time = $request_typ->price_per_unit_time; } else { // $setbase_distance = $request_typ->base_distance; $setbase_distance = ""; $provider_type = ProviderServices::where('type', $walker_data->type)->where('provider_id', $walker_id)->first(); $base_price = $provider_type->base_price; $price_per_unit_distance = $provider_type->price_per_unit_distance; $price_per_unit_time = $provider_type->price_per_unit_time; } $settings = Settings::where('key', 'default_charging_method_for_users')->first(); $pricing_type = $settings->value; $settings = Settings::where('key', 'default_distance_unit')->first(); //$unit = $settings->value; $distance = convert($distance); if ($pricing_type == 1) { if ($distance <= $setbase_distance) { $distance_cost = 0; } else { $distance_cost = $price_per_unit_distance * ($distance - $setbase_distance); } $time_cost = $price_per_unit_time * $time; $total = $base_price + $distance_cost + $time_cost; } else { $distance_cost = 0; $time_cost = 0; $total = $base_price; } $current_request->is_completed = 1; $current_request->distance = $distance; $current_request->time = $time; $request_services->base_price = $base_price; $request_services->distance_cost = $distance_cost; $request_services->time_cost = $time_cost; $request_services->total = $total; $current_request->total = $total; $request_services->save(); // charge client // charge client $ledger = Ledger::where('owner_id', $current_request->owner_id)->first(); if ($ledger) { $balance = $ledger->amount_earned - $ledger->amount_spent; if ($balance > 0) { if ($total > $balance) { $ledger_temp = Ledger::find($ledger->id); $ledger_temp->amount_spent = $ledger_temp->amount_spent + $balance; $ledger_temp->save(); $total = $total - $balance; } else { $ledger_temp = Ledger::find($ledger->id); $ledger_temp->amount_spent = $ledger_temp->amount_spent + $total; $ledger_temp->save(); $total = 0; } } } $promo_discount = 0; if ($pcode = PromoCodes::where('id', $current_request->promo_code)->where('type', 1)->first()) { $discount = $pcode->value / 100; $promo_discount = $total * $discount; $total = $total - $promo_discount; if ($total < 0) { $total = 0; } } $current_request->total = $total; $current_request->save(); $cod_sett = Settings::where('key', 'cod')->first(); $allow_cod = $cod_sett->value; if ($current_request->payment_mode == 1 and $allow_cod == 1) { // Pay by Cash $current_request->is_paid = 1; Log::info('allow_cod'); } elseif ($current_request->payment_mode == 2) { // paypal Log::info('paypal payment'); } else { Log::info('normal payment. Stored cards'); // stored cards if ($total == 0) { $current_request->is_paid = 1; } else { $payment_data = Payment::where('owner_id', $current_request->owner_id)->where('is_default', 1)->first(); if (!$payment_data) { $payment_data = Payment::where('owner_id', $current_request->owner_id)->first(); } if ($payment_data) { $customer_id = $payment_data->customer_id; $setransfer = Settings::where('key', 'transfer')->first(); $transfer_allow = $setransfer->value; if (Config::get('app.default_payment') == 'stripe') { //dd($customer_id); Stripe::setApiKey(Config::get('app.stripe_secret_key')); try { $charge = Stripe_Charge::create(array("amount" => ceil($total * 100), "currency" => "usd", "customer" => $customer_id)); Log::info($charge); } catch (Stripe_InvalidRequestError $e) { // Invalid parameters were supplied to Stripe's API $ownr = Owner::find($current_request->owner_id); $ownr->debt = $total; $ownr->save(); $message = array('error' => $e->getMessage()); $type = "success"; Log::info($message); return Redirect::to('/provider/tripinprogress')->with('message', $message)->with('type', $type); } $current_request->is_paid = 1; $settng = Settings::where('key', 'service_fee')->first(); $settng_mode = Settings::where('key', 'payment_mode')->first(); if ($settng_mode->value == 2 and $transfer_allow == 1) { $transfer = Stripe_Transfer::create(array("amount" => ($total - $settng->value * $total / 100) * 100, "currency" => "usd", "recipient" => $walker_data->merchant_id)); $current_request->transfer_amount = $total - $settng->value * $total / 100; } } else { try { Braintree_Configuration::environment(Config::get('app.braintree_environment')); Braintree_Configuration::merchantId(Config::get('app.braintree_merchant_id')); Braintree_Configuration::publicKey(Config::get('app.braintree_public_key')); Braintree_Configuration::privateKey(Config::get('app.braintree_private_key')); if ($settng_mode->value == 2 and $transfer_allow == 1) { $sevisett = Settings::where('key', 'service_fee')->first(); $service_fee = $sevisett->value * $total / 100; $result = Braintree_Transaction::sale(array('amount' => $total - $service_fee, 'paymentMethodNonce' => $customer_id, 'merchantAccountId' => $walker_data->merchant_id, 'options' => array('submitForSettlement' => true, 'holdInEscrow' => true), 'serviceFeeAmount' => $service_fee)); } else { $result = Braintree_Transaction::sale(array('amount' => $total, 'paymentMethodNonce' => $customer_id)); } if ($result->success) { $request->is_paid = 1; } else { $request->is_paid = 0; } } catch (Exception $e) { $message = "Something went wrong in the payment. Please try again."; $type = "success"; return Redirect::to('/provider/tripinprogress')->with('message', $message)->with('type', $type); } } $current_request->card_payment = $total; $current_request->ledger_payment = $current_request->total - $total; } } } $current_request->save(); } $current_request->save(); } return Redirect::to('/provider/tripinprogress'); }
/** * 获得当前页面的“所在位置” * * @param $data * @param int $pid * @author yangyifan <*****@*****.**> */ function get_location($category, $pid = 0) { $data = []; if (!empty($category)) { foreach ($category as $location) { if ($location['id'] == $pid) { $data[] = $location; $data = array_merge($data, get_location($category, $location['pid'])); } } } return $data; }
public function walk_location() { if (Request::isMethod('post')) { $request_id = Input::get('request_id'); $token = Input::get('token'); $walker_id = Input::get('id'); $latitude = Input::get('latitude'); $longitude = Input::get('longitude'); if (Input::has('bearing')) { $angle = Input::get('bearing'); } $validator = Validator::make(array('request_id' => $request_id, 'token' => $token, 'walker_id' => $walker_id, 'latitude' => $latitude, 'longitude' => $longitude), array('request_id' => 'required|integer', 'token' => 'required', 'walker_id' => 'required|integer', 'latitude' => 'required', 'longitude' => 'required')); if ($validator->fails()) { $error_messages = $validator->messages()->all(); $response_array = array('success' => false, 'error' => 'Invalid Input', 'error_code' => 401, 'error_messages' => $error_messages); $response_code = 200; } else { $unit = $unit_set = -1; $settings = Settings::where('key', 'default_distance_unit')->first(); $unit = $settings->value; if ($unit == 0) { $unit_set = 'kms'; } elseif ($unit == 1) { $unit_set = 'miles'; } $is_admin = $this->isAdmin($token); if ($walker_data = $this->getWalkerData($walker_id, $token, $is_admin)) { // check for token validity if (is_token_active($walker_data->token_expiry) || $is_admin) { // Do necessary operations if ($request = Requests::find($request_id)) { if ($request->confirmed_walker == $walker_id) { if ($request->is_started == 1) { $walk_location_last = WalkLocation::where('request_id', $request_id)->orderBy('created_at', 'desc')->first(); if ($walk_location_last) { $distance_old = $walk_location_last->distance; $distance_new = distanceGeoPoints($walk_location_last->latitude, $walk_location_last->longitude, $latitude, $longitude); $distance = $distance_old + $distance_new; $settings = Settings::where('key', 'default_distance_unit')->first(); $unit = $settings->value; if ($unit == 0) { $unit_set = 'kms'; } elseif ($unit == 1) { $unit_set = 'miles'; } $distancecon = convert($distance, $unit); } else { $distance = 0; } $walker = Walker::find($walker_id); $location = get_location($latitude, $longitude); $latitude = $location['lat']; $longitude = $location['long']; if (!isset($angle)) { $angle = get_angle($walker->latitude, $walker->longitude, $latitude, $longitude); } $walker->old_latitude = $walker->latitude; $walker->old_longitude = $walker->longitude; $walker->latitude = $latitude; $walker->longitude = $longitude; $walker->bearing = $angle; $walker->save(); /* GET SECOND LAST ENTY FOR TIME */ $loc1 = WalkLocation::where('request_id', $request->id)->orderBy('id', 'desc')->first(); /* GET SECOND LAST ENTY FOR TIME END */ if ($request->is_completed != 1) { $walk_location = new WalkLocation(); $walk_location->request_id = $request_id; $walk_location->latitude = $latitude; $walk_location->longitude = $longitude; $walk_location->distance = $distance; $walk_location->bearing = $angle; $walk_location->save(); } $one_minut_old_time = date("Y-m-d H:i:s", strtotime(date("Y-m-d H:i:s")) - 60); /* $loc1 = WalkLocation::where('request_id', $request->id)->first(); */ /* print $loc1; */ $loc2 = WalkLocation::where('request_id', $request->id)->orderBy('id', 'desc')->first(); if ($loc1) { $time1 = strtotime($loc2->created_at); $time2 = strtotime($loc1->created_at); /* echo $difference = intval(($time1 - $time2) / 60); */ $difference = ($time1 - $time2) / 60; $loc1min = WalkLocation::where('request_id', $request->id)->where('created_at', '<=', $one_minut_old_time)->orderBy('id', 'desc')->first(); $distence = distanceGeoPoints($loc1min->latitude, $loc1min->longitude, $latitude, $longitude); if ($request->is_completed != 1) { if ($distence <= 50) { $request->time = $request->time + $difference; } else { $request->time = $request->time; } } } else { $request->time = 0; } $request->save(); $response_array = array('success' => true, 'dest_latitude' => $request->D_latitude, 'dest_longitude' => $request->D_longitude, 'payment_type' => $request->payment_mode, 'is_cancelled' => $request->is_cancelled, 'distance' => $distancecon, 'unit' => $unit_set, 'time' => $difference); $response_code = 200; } else { $walker = Walker::find($walker_id); $location = get_location($latitude, $longitude); $latitude = $location['lat']; $longitude = $location['long']; if (!isset($angle)) { $angle = get_angle($walker->latitude, $walker->longitude, $latitude, $longitude); } $walker->old_latitude = $walker->latitude; $walker->old_longitude = $walker->longitude; $walker->latitude = $latitude; $walker->longitude = $longitude; $walker->bearing = $angle; $walker->save(); $response_array = array('success' => false, 'dest_latitude' => $request->D_latitude, 'dest_longitude' => $request->D_longitude, 'payment_type' => $owner->payment_mode, 'is_cancelled' => $request->is_cancelled, 'unit' => $unit_set, 'error' => 'Service not yet started', 'error_code' => 414); $response_code = 200; } } else { /* $var = Keywords::where('id', 1)->first(); $response_array = array('success' => false, 'error' => 'Request ID doesnot matches with ' . $var->keyword . ' ID', 'error_code' => 407); */ $response_array = array('success' => false, 'dest_latitude' => $request->D_latitude, 'dest_longitude' => $request->D_longitude, 'payment_type' => $owner->payment_mode, 'is_cancelled' => $request->is_cancelled, 'unit' => $unit_set, 'error' => 'Request ID doesnot matches with ' . Config::get('app.generic_keywords.Provider') . ' ID', 'error_code' => 407); $response_code = 200; } } else { $response_array = array('success' => false, 'error' => 'Service ID Not Found', 'error_code' => 408); $response_code = 200; } } else { $response_array = array('success' => false, 'error' => 'Token Expired', 'error_code' => 405); $response_code = 200; } } else { if ($is_admin) { /* $var = Keywords::where('id', 1)->first(); $response_array = array('success' => false, 'error' => '' . $var->keyword . ' ID not Found', 'error_code' => 410); */ $response_array = array('success' => false, 'error' => '' . Config::get('app.generic_keywords.Provider') . ' ID not Found', 'error_code' => 410); } else { $response_array = array('success' => false, 'error' => 'Not a valid token', 'error_code' => 406); } $response_code = 200; } } } $response = Response::json($response_array, $response_code); return $response; }
require_once SM_PATH . 'include/validate.php'; require_once SM_PATH . 'functions/global.php'; require_once SM_PATH . 'functions/display_messages.php'; require_once SM_PATH . 'functions/html.php'; /* POST data var names are dynamic because of the possible multiple idents so lets get them all FIXME! This circumvents the benefits of rg=0 */ if (!empty($_POST)) { extract($_POST); } /* got 'em all */ if (isset($return)) { SaveUpdateFunction(); header('Location: ' . get_location() . '/options_personal.php'); exit; } displayPageHeader($color, 'None'); $Info = do_hook('options_identities_process', 0); if ($Info[1]) { SaveUpdateFunction(); } if (CheckAndDoDefault() || CheckAndDoPromote()) { SaveUpdateFunction(); } if (isset($update) || CheckForDelete()) { SaveUpdateFunction(); } do_hook('options_identities_top'); LoadInfo($full_name, $email_address, $reply_to, $signature, '');
/** * 提交保存点评 * @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; } }
// Option: media_enable echo html_tag('tr') . html_tag('td', _("Enable Media Playing") . ':', 'right', '', 'nowrap') . html_tag('td', '', 'left') . '<input type="checkbox" '; if ($media_enable == 'on') { echo 'checked="checked" '; } echo 'name="media_enable" /></td></tr>' . "\n"; // Option: media_sel echo html_tag('tr') . html_tag('td', _("Select server file") . ':', 'right', '', 'nowrap') . html_tag('td', '', 'left') . '<select name="media_sel">' . "\n" . '<option value="(none)"'; if ($media == '(none)') { echo 'selected="selected" '; } echo '>' . _("(none)") . '</option>' . "\n"; // Iterate sound files for options $d = dir(SM_PATH . 'plugins/newmail/sounds'); while ($entry = $d->read()) { $fname = get_location() . '/sounds/' . $entry; if ($entry != '..' && $entry != '.' && $entry != 'CVS' && $entry != 'index.php') { echo '<option '; if ($fname == $media) { echo 'selected="selected" '; } echo 'value="' . htmlspecialchars($fname) . '">' . htmlspecialchars($entry) . "</option>\n"; } } $d->close(); $media_output = $media == '(none)' ? _("(none)") : substr($media, strrpos($media, '/') + 1); echo '</select>' . '<input type="submit" value="' . _("Try") . '" name="test" onClick="' . "window.open('testsound.php?sound='+media_sel.options[media_sel.selectedIndex].value, 'TestSound'," . "'width=150,height=30,scrollbars=no');" . 'return false;' . '" /></td></tr>' . html_tag('tr', "\n" . html_tag('td', _("Current File:"), 'right', '', 'nowrap') . html_tag('td', '<input type="hidden" value="' . htmlspecialchars($media) . '" name="media_default">' . htmlspecialchars($media_output) . '', 'left')) . "\n"; } echo html_tag('tr', "\n" . html_tag('td', ' ') . html_tag('td', '<input type="hidden" name="optmode" value="submit" />' . '<input type="hidden" name="optpage" value="newmail" />' . '<input type="submit" value="' . _("Submit") . '" name="submit_newmail" />', 'left')) . "\n"; ?> </table></form></td></tr></table></td></tr></table></body></html>
<div id="home_container"> <div class="layout-1200 uk-container uk-container-center"> <div id="signup_panel" class="uk-width-1-1 uk-border-rounded uk-container-center uk-text-center"> <h1>Join the Trading Revolution</h1> <form method="POST" onsubmit="clearIncomplete(this);" action="/signup/process.php" id="signup_form"> <div class="uk-width-medium-1-3 uk-container-center"> <input class="uk-width-1-1 text_medium" name="fname" id="fname" autocomplete="off" type="text" placeholder="First Name" /><br/> <input class="uk-width-1-1 text_medium" name="lname" id="lname" autocomplete="off" type="text" placeholder="Last Name" /><br/> <input class="uk-width-1-1 text_medium" name="eaddr" id="eaddr" autocomplete="off" type="text" placeholder=".edu Address" /><br/> <input class="uk-width-1-1 text_medium" name="pword" id="pword" autocomplete="off" type="password" placeholder="Password" /> <input class="uk-width-1-1 text_medium" name="rpword" id="rpword" autocomplete="off" type="password" placeholder="Retype Password" /> <?php $location_html = "<b>Could not detect location</b>"; $location_array = get_location(); try { if (trim($location_array["properties"]["city"]) != "" && trim($location_array["properties"]["region"]) != "") { $location_html = "<b>General Location: </b>{$location_array["properties"]["city"]}, {$location_array["properties"]["region"]}"; } } catch (Exception $e) { } ?> <div id="geo_location"> <?php echo $location_html; ?> </div> <input type="submit" id="signup_submit" class="reset_margin uk-width-1-1 uk-align-center button_primary green" value="Let's Roll!" />
displayPageHeader($color, 'None'); plain_error_message(_("Illegal folder name. Please select a different name.") . '<br /><a href="../src/folders.php">' . _("Click here to go back") . '</a>.', $color); exit; } $orig = imap_utf7_encode_local($orig); $old_name = imap_utf7_encode_local($old_name); $new_name = imap_utf7_encode_local($new_name); if ($old_name != $new_name) { $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0); if (strpos($orig, $delimiter)) { $old_dir = substr($orig, 0, strrpos($orig, $delimiter)); } else { $old_dir = ''; } if ($old_dir != '') { $newone = $old_dir . $delimiter . $new_name; } else { $newone = $new_name; } // Renaming a folder doesn't rename the folder but leaves you unsubscribed // at least on Cyrus IMAP servers. if (isset($isfolder)) { $newone = $newone . $delimiter; $orig = $orig . $delimiter; } sqimap_mailbox_rename($imapConnection, $orig, $newone); // Log out this session sqimap_logout($imapConnection); } header('Location: ' . get_location() . '/folders.php?success=rename');
case "~time-add": set_location_alias($alias, $trailing); break; case "~time-del": if (del_location($trailing) == True) { privmsg("location \"{$trailing}\" deleted"); } else { if (trim($trailing) != "") { privmsg("location for \"{$trailing}\" not found"); } else { privmsg("syntax: ~time-del <name>"); } } break; case "~time": $loc = get_location($trailing, $nick); if ($loc === False) { if ($trailing == "") { privmsg("syntax: ~time location"); privmsg("time data courtesy of Google"); return; } $loc = $trailing; } term_echo("*** TIME LOCATION: {$loc}"); $result = get_time($loc); if ($result != "") { $arr = convert_google_location_time($result); #privmsg($result); privmsg(date("l, j F Y @ g:i a", $arr["timestamp"]) . " " . $arr["timezone"] . " - " . $arr["location"]); } else {
/** * Route a call to an extension. Set the params for all the types of divert. * @param $called Number the call was placed to * @return Bool true if number was routed, false otherwise */ function routeToExtension($called) { global $no_pbx, $ev, $voicemail, $system_prefix, $query_on, $debug_on; // debug("entered routeToExtension('$called')"); if (strlen($called) < 3) { return false; } $pref_ext = $system_prefix . $called; debug("trying routeToExtension(called='{$called}' or called='{$pref_ext}')"); $query = "SELECT location,extension_id FROM extensions WHERE extension='{$called}' OR '{$system_prefix}' || extension='{$called}'"; $res = query_to_array($query); if (!count($res)) { return false; } $destination = $res[0]["location"]; $extension_id = $res[0]["extension_id"]; if (!$no_pbx) { // select voicemail location $query = "SELECT value FROM settings WHERE param='vm'"; $res = query_to_array($query); if (!$res || !count($res)) { debug("Voicemail is not set!!!"); $voicemail = NULL; } else { $voicemail = $res[0]["value"]; } // select pbx settings for the called number $query = "SELECT MAX(CASE WHEN param='forward' THEN value END) as \"div\",MAX(CASE WHEN param='forward_busy' THEN value END) as div_busy,MAX(CASE WHEN param='forward_noanswer' THEN value END) as div_noanswer, MAX(CASE WHEN param='noanswer_timeout' THEN value END) as noans_timeout FROM pbx_settings WHERE extension_id='{$extension_id}'"; $res = query_to_array($query); $div = $res[0]["div"]; $div_busy = $res[0]["div_busy"]; $div_noanswer = $res[0]["div_noanswer"]; $noans_timeout = $res[0]["noans_timeout"]; if ($div == $called || !$div) { // set the additional divert params if ($div_busy && $div_busy != '') { $ev->params["divert_busy"] = get_location($div_busy); } if ($div_noanswer != '' && $div_noanswer) { $ev->params["divert_noanswer"] = get_location($div_noanswer); $ev->params["maxcall"] = $noans_timeout * 1000; } } else { // all calls should be diverted to $div $destination = get_location($div); if ($destination && $div != "vm") { $ev->params["called"] = $div; } } } // if no destination found, try sending call to voicemail(it might be set or not) if (!$destination) { $destination = $voicemail; } $ev->params["query_on"] = $query_on ? "yes" : "no"; $ev->params["debug_on"] = $debug_on ? "yes" : "no"; set_retval($destination, "offline"); return true; }
public function view_ads() { $data = []; return view(get_location('spidro.ad_view.main'), $data); }
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); }
/** This is the configtest page */ define('PAGE_NAME', 'configtest'); /** @ignore */ define('SM_PATH', '../'); /* * Load config before output begins. * functions/global.php cleans environment, then loads * functions/strings.php and config/config.php */ if (file_exists(SM_PATH . 'config/config.php')) { include SM_PATH . 'functions/global.php'; } $IND = str_repeat(' ', 4); // this must be done before the output is started because it may use the // session $test_location = get_location(); ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta name="robots" content="noindex,nofollow"> <title>SquirrelMail configtest</title> </head> <body> <h1>SquirrelMail configtest</h1> <p>This script will try to check some aspects of your SquirrelMail configuration and point you to errors whereever it can find them. You need to go run <tt>conf.pl</tt> in the <tt>config/</tt> directory first before you run this script.</p> <?php
function get_location_name($id) { return get_location($id, 'title'); }
<?php ##################################################################################################### /* exec:~location|5|0|0|0|||||php scripts/location.php %%trailing%% */ ##################################################################################################### require_once "lib.php"; require_once "weather_lib.php"; $location = strtolower(trim($argv[1])); $code = get_location($location); if ($code === False or $code == "") { privmsg("*** location \"{$location}\" not found"); } else { privmsg("*** location \"{$location}\" = \"{$code}\""); } #####################################################################################################
/** * 获得全部论坛分类 * * @param $data * @author yangyifan <*****@*****.**> */ public static function getForumLocation($data) { //加载函数库 load_func('common'); $all_category = obj_to_array(self::select('cat_name', 'id', 'pid')->get()); $data = get_location($all_category, $data->forum_cat_id); //翻转函数 $data = array_reverse($data); return $data; }
} } /** First create the top node in the tree **/ for ($i = 0; $i < $numboxes; $i++) { if ($boxes[$i]['unformatted-dm'] == $mailbox && strlen($boxes[$i]['unformatted-dm']) == strlen($mailbox)) { $foldersTree[0]['value'] = $mailbox; $foldersTree[0]['doIHaveChildren'] = false; continue; } } /* Now create the nodes for subfolders of the parent folder You can tell that it is a subfolder by tacking the mailbox delimiter on the end of the $mailbox string, and compare to that. */ for ($i = 0; $i < $numboxes; $i++) { if (substr($boxes[$i]['unformatted'], 0, strlen($mailbox_no_dm . $delimiter)) == $mailbox_no_dm . $delimiter) { addChildNodeToTree($boxes[$i]["unformatted"], $boxes[$i]['unformatted-dm'], $foldersTree); } } /** Lets start removing the folders and messages **/ if ($move_to_trash == true && $can_move_to_trash == true) { /** if they wish to move messages to the trash **/ walkTreeInPostOrderCreatingFoldersUnderTrash(0, $imap_stream, $foldersTree, $mailbox); walkTreeInPreOrderDeleteFolders(0, $imap_stream, $foldersTree); } else { /** if they do NOT wish to move messages to the trash (or cannot)**/ walkTreeInPreOrderDeleteFolders(0, $imap_stream, $foldersTree); } /** Log out this session **/ sqimap_logout($imap_stream); $location = get_location(); header("Location: {$location}/folders.php?success=delete");
$_ip = intval($ms[1][$i]) * 256 * 256 * 256 + intval($ms[2][$i]) * 256 * 256 + intval($ms[3][$i]) * 256 + intval($ms[4][$i]); } } $r = mysql_query("SELECT * FROM `chat_online` WHERE `to`='0' AND `time`>'" . ($t - 2) . "' AND `ip`!= '{$_ip}' ORDER BY `time` ASC LIMIT 1"); $r = mysql_query("SELECT * FROM `chat_online` WHERE `to`='0' AND `time`>'" . ($t - 5) . "' ORDER BY `time` ASC LIMIT 1"); if (mysql_num_rows($r) > 0) { $arr = mysql_fetch_assoc($r); $to = $arr['id']; $to_location = get_location($arr['ip']); } else { $to = '0'; } $sql = "INSERT INTO `chat_online`(`id`,`to`,`time`,`ip`) VALUES('{$id}','{$to}','{$t}','{$_ip}')"; if (mysql_query($sql)) { if ($to != '0') { $my_location = get_location($_ip); mysql_query("UPDATE `chat_online` SET `to`='{$id}' WHERE `id`='{$to}'"); mysql_query("INSERT INTO `chat_event`(`from`,`to`,`time`,`type`,`content`) VALUES " . "('{$id}','{$to}','{$t}','connected','{$my_location}')," . "('{$to}','{$id}','{$t}','connected','{$to_location}') "); } echo $id; die; } else { echo 'error'; } function get_location($ip) { $r = mysql_query("SELECT * FROM chat_ip WHERE `from`<'{$ip}' AND `to`>'{$ip}' ORDER BY `range` ASC LIMIT 1"); if (mysql_num_rows($r) > 0) { $arr = mysql_fetch_assoc($r); return $arr['name'] ? $arr['name'] : '未知'; } else {