• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

PHP get_location函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中get_location函数的典型用法代码示例。如果您正苦于以下问题:PHP get_location函数的具体用法?PHP get_location怎么用?PHP get_location使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了get_location函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: get_info

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]+;)/', '&amp;', $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;
}
开发者ID:xyuanmu,项目名称:parsexiami,代码行数:59,代码来源:index.php


示例2: delete_move_next_read

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>&nbsp;|&nbsp;";
    } else {
        echo _("Previous") . "&nbsp;|&nbsp;";
    }
    echo "<a href=\"read_body.php?passed_id={$next}&mailbox={$urlMailbox}&sort={$sort}&startMessage={$startMessage}&show_more=0\">" . _("Next") . "</a>&nbsp;|&nbsp;";
    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>" . "&nbsp;|&nbsp;";
    } else {
        echo _("Delete & Prev") . "&nbsp;|&nbsp;";
    }
    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 
}
开发者ID:teammember8,项目名称:roundcube,代码行数:53,代码来源:setup.php


示例3: main

 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');
 }
开发者ID:lxp521125,项目名称:TP-Admin,代码行数:14,代码来源:IndexAction.class.php


示例4: save_to_database

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']}");
        //
    }
}
开发者ID:stormhair,项目名称:iCampusEvent-Backend,代码行数:15,代码来源:utility.php


示例5: show_welcome

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"]));
}
开发者ID:cmn32480,项目名称:exec-irc-bot,代码行数:20,代码来源:welcome.php


示例6: load_msg

 /**
  * 加载相应的类型消息
  * @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;
 }
开发者ID:macall,项目名称:jsd,代码行数:45,代码来源:dp_msg.php


示例7: login

 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;
     }
 }
开发者ID:Nickersoft,项目名称:eDart,代码行数:36,代码来源:login.php


示例8: get_view

 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;
 }
开发者ID:Ahmed-Badawy,项目名称:ahmed-badawy.com-Website,代码行数:24,代码来源:BaseController.php


示例9: setPref

                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);
开发者ID:teammember8,项目名称:roundcube,代码行数:31,代码来源:options_highlight.php


示例10: list

    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);
开发者ID:BackupTheBerlios,项目名称:hpt-obm-svn,代码行数:30,代码来源:mailto.php


示例11: get_location

?>
</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 -->
开发者ID:hevelmo,项目名称:themes,代码行数:31,代码来源:properties-rows.php


示例12: index

 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);
//.........这里部分代码省略.........
开发者ID:macall,项目名称:jishida,代码行数:101,代码来源:dp_list.action.php


示例13: providerTripChangeState

 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();
//.........这里部分代码省略.........
开发者ID:felipemarques8,项目名称:goentregas,代码行数:101,代码来源:WebProviderController.php


示例14: get_location

 /**
  * 获得当前页面的“所在位置”
  *
  * @param $data
  * @param int $pid
  * @author yangyifan <[email protected]>
  */
 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;
 }
开发者ID:iwillhappy1314,项目名称:laravel-admin,代码行数:20,代码来源:common.func.php


示例15: walk_location

 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);
//.........这里部分代码省略.........
开发者ID:felipemarques8,项目名称:goentregas,代码行数:101,代码来源:WalkerController.php


示例16: extract

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, '');
开发者ID:BackupTheBerlios,项目名称:hpt-obm-svn,代码行数:31,代码来源:options_identities.php


示例17: save_review

/**
 * 提交保存点评
 * @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(&qu 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP get_location_name_by_id函数代码示例发布时间:2022-05-15
下一篇:
PHP get_localtax函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap