/** * 模拟登录 */ public function Login($verifycode = NULL) { $data = $this->account; if (!is_numeric($data['username']) && !str_contains($data['username'], '@')) { return '用户名格式错误,请输入QQ号或QQ邮箱。'; } Session::Set('qq', $data['username']); if (!$verifycode) { $ret = $this->get('http://check.ptlogin2.qq.com/check?appid=15000101&uin=' . $data['username']); // $arr = explode("'", $ret); $verifycode = $arr[3]; if (strlen($verifycode) != 4) { return '绑定账号失败:请输入验证码'; //'登录服务暂时不可用,请稍后再试!'; } } $param = array('aid' => 15000101, 'fp' => 'loginerroralert', 'from_ui' => 1, 'g' => 1, 'h' => 1, 'u' => $data['username'], 'p' => $this->encpwd($data['password'], $data['username'], $verifycode), 'verifycode' => $verifycode, 'u1' => 'http://imgcache.qq.com/qzone/v5/loginsucc.html?para=izone'); Log::customLog('qzone.txt', "GET http://ptlogin2.qq.com/login:\r\n" . print_r($param, true)); $ret = $this->get('http://ptlogin2.qq.com/login?' . http_build_query($param)); Log::customLog('qzone.txt', "Response:\r\n" . print_r($this->http_header, true) . print_r($ret, true)); $arr = explode("'", $ret); $ret = $arr[9]; if (start_with($ret, '登录成功')) { return true; } return $ret; }
/** * 捕获未定义的方法 * @param sting $method 变量key和with组合 * @param mixed $parameters 变量值 * @return obj [description] */ public function __call($method, $parameters) { if (start_with($method, 'with')) { static::with(lcfirst(substr_replace($method, '', 0, 4)), $parameters[0]); } else { die("Function [{$method}] does not exist!"); } return new static(); }
/** * POST请求 * @param string $url URL * @param array $data post数据 * @param string $request_encoding 请求的编码 * @param bool $multipart 是否是上传请求 */ public function post($url, $data, $request_encoding = 'UTF-8', $multipart = false, $cookie = NULL) { $ret = $this->http($url, 'POST', $data, $request_encoding, $multipart, $cookie); if (start_with($ret, '{') || start_with($ret, '{')) { $json = @json_decode($ret, true); if ($json) { $ret = $json; } } return $ret; }
function cookie($name, $value = null, $expire = 0, $path = '/', $secure = false, $httpOnly = true) { $name = start_with($name, 'chestnut_') ? $name : 'chestnut_' . $name; if (is_null($value) && ($cookie = app('request')->cookies->get($name))) { try { return decrypt($cookie); } catch (Exception $e) { return $cookie; } } $value = $path === false ? $value : encrypt($value); if (is_numeric($expire) && $expire > 0) { $expire = time() + $expire; } $value === false ? '' : $value; $cookie = app('cookie', ['name' => $name, 'value' => $value, 'expire' => $value === false ? -1 : $expire, 'path' => $path, 'domain' => config('app.domain'), 'secure' => $secure, 'httpOnly' => $httpOnly]); app('response')->headers->setCookie($cookie); }
/** * Рекурсивная функция для формирования меню навигации * * @param object $navi_menu меню (шаблоны, параметры) * @param array $navi_items (пункты по родителям) * @param array $navi_active_way ("активный путь") * @param array $navi_item_tpl (шаблоны пунктов) * @param int $parent (исследуемый родитель, изначально 0 - верхний уровень) * @return string $navi - готовый код навигации */ function printNavi($navi_menu, $navi_items, $navi_active_way, $navi_item_tpl, $parent = 0) { // выясняем уровень $navi_item_level = $navi_items[$parent][0]['navi_item_level']; // собираем каждый пункт в данном родителе -> в переменной $item foreach ($navi_items[$parent] as $row) { // Проверяем пункт меню на принадлежность к "активному пути" и выбираем шаблон $item = in_array($row['Id'], $navi_active_way) ? $navi_item_tpl[$navi_item_level]['active'] : $navi_item_tpl[$navi_item_level]['inactive']; ################### ПАРСИМ ТЕГИ ################### // id @($item = str_replace('[tag:linkid]', $row['Id'], $item)); // название @($item = str_replace('[tag:linkname]', $row['title'], $item)); // ссылка if (strpos($row['navi_item_link'], 'module=') === false && start_with('index.php?', $row['navi_item_link'])) { $item = str_replace('[tag:link]', $row['navi_item_link'] . "&doc=" . (!$row['document_alias'] ? prepare_url($row['title']) : $row['document_alias']), $item); $item = str_ireplace('"//"', '"/"', str_ireplace('///', '/', rewrite_link($item))); } else { $item = str_replace('[tag:link]', $row['navi_item_link'], $item); if (start_with('www.', $row['navi_item_link'])) { $item = str_replace('www.', 'http://www.', $item); } } // target $item = str_replace('[tag:target]', empty($row['navi_item_target']) ? '_self' : $row['navi_item_target'], $item); // описание @($item = str_replace('[tag:desc]', stripslashes($row['navi_item_desc']), $item)); // изображение @($item = str_replace('[tag:img]', stripslashes($row['navi_item_Img']), $item)); @($img = explode(".", $row['navi_item_Img'])); @($row['Img_act'] = $img[0] . "_act." . $img[1]); @($item = str_replace('[tag:img_act]', stripslashes($row['Img_act']), $item)); @($item = str_replace('[tag:img_id]', stripslashes($row['navi_item_Img_id']), $item)); ################### /ПАРСИМ ТЕГИ ################## // Определяем тег для вставки следующего уровня switch ($navi_item_level) { case 1: $tag = '[tag:level:2]'; break; case 2: $tag = '[tag:level:3]'; } // Если есть подуровень, то заново запускаем для него функцию и вставляем вместо тега if (!empty($navi_items[$row['Id']])) { $item_sublevel = printNavi($navi_menu, $navi_items, $navi_active_way, $navi_item_tpl, $row['Id']); $item = @str_replace($tag, $item_sublevel, $item); } else { $item = @str_replace($tag, '', $item); } // Подставляем в переменную навигации готовый пункт if (empty($navi)) { $navi = ''; } $navi .= $item; } // Вставляем все пункты уровня в шаблон уровня switch ($navi_item_level) { case 1: $navi = str_replace("[tag:content]", $navi, $navi_menu->navi_level1begin); break; case 2: $navi = str_replace("[tag:content]", $navi, $navi_menu->navi_level2begin); break; case 3: $navi = str_replace("[tag:content]", $navi, $navi_menu->navi_level3begin); break; } // Возвращаем сформированный уровень return $navi; }
function in_namespace($class, $namespace) { if (is_object($class)) { $class = get_class($class); } $class = ltrim($class, '\\'); $namespace = trim($namespace, '\\') . '\\'; return start_with($class, $namespace, true); }
public function url($routeName, $method = 'get') { $params = []; if (!in_array(strtolower($method), $this->supportMethod)) { $params[] = $method; $method = 'get'; } if (func_num_args() > 2) { $args = func_get_args(); $params = array_merge($params, array_slice($args, 2)); } if ($this->routes->hasRoute($routeName)) { $route = $this->routes->getRoute($routeName); $method = strtoupper($method); if (!isset($route[$method])) { throw new UndefinedRouteException("Undefined [{$routeName}] Route with [{$method}] method"); } if ($url = $route[$method]->identifierMatch($params)) { return $this->domain . $url; } throw new InvalidArgumentException("Missing parameter in [{$routeName}] Route"); } if (start_with($routeName, 'http://') || start_with($routeName, 'https://')) { return $routeName; } return start_with($routeName, '/') ? $this->domain . $routeName : $this->domain . '/' . $routeName; }
private function test_utility_helper() { $this->unit->use_strict(true); $this->unit->run(get_github_url(), 'is_string', 'get_github_url()'); $this->unit->run(get_facebook_url(), 'is_string', 'get_facebook_url()'); $this->unit->run(get_twitter_url(), 'is_string', 'get_twitter_url()'); $this->unit->run(get_google_map_key(), 'is_string', 'get_google_map_key()'); $this->unit->run(get_ga_code(), 'is_string', 'get_ga_code()'); $this->unit->run(is_null_or_empty_string(''), 'is_true', 'is_null_or_empty_string()'); $this->unit->run(is_null_or_empty_string('test'), 'is_false', 'is_null_or_empty_string()'); $this->unit->run(is_null_or_empty_string(1), 'is_false', 'is_null_or_empty_string()'); $this->unit->run(start_with('abcdef', 'ab'), 'is_true', 'start_with()'); $this->unit->run(start_with('abcdef', 'cd'), 'is_false', 'start_with()'); $this->unit->run(start_with('abcdef', 'ef'), 'is_false', 'start_with()'); $this->unit->run(start_with('abcdef', ''), 'is_true', 'start_with()'); $this->unit->run(start_with('', 'abcdef'), 'is_false', 'start_with()'); $this->unit->run(end_with("abcdef", "ab"), 'is_false', 'end_with()'); $this->unit->run(end_with("abcdef", "cd"), 'is_false', 'end_with()'); $this->unit->run(end_with("abcdef", "ef"), 'is_true', 'end_with()'); $this->unit->run(end_with("abcdef", ""), 'is_true', 'end_with()'); $this->unit->run(end_with("", "abcdef"), 'is_false', 'end_with()'); $this->unit->run(get_domain_name('http://somedomain.co.uk'), 'somedomain.co.uk', 'get_domain_name()'); $this->unit->run(get_domain_name('http://www2.manager.co.th'), 'manager.co.th', 'get_domain_name()'); $this->unit->run(get_domain_name('http://test.manager.co.th'), 'manager.co.th', 'get_domain_name()'); $this->unit->run(get_domain_name('http://manager.co.th'), 'manager.co.th', 'get_domain_name()'); $this->unit->run(get_domain_name('http://thaiware.com'), 'thaiware.com', 'get_domain_name()'); $this->unit->run(get_domain_name('http://www.thaiware.com'), 'thaiware.com', 'get_domain_name()'); $this->unit->run(get_domain_name('http://test.thaiware.com'), 'thaiware.com', 'get_domain_name()'); $this->unit->run(get_domain_name('http://www.studentloan.ktb.co.th/'), 'ktb.co.th', 'get_domain_name()'); $this->unit->run(get_domain_name('http://www.studentloan.ktb.co.th/dasdasdasd.html'), 'ktb.co.th', 'get_domain_name()'); $this->unit->run(get_domain_name('http://www.studentloan.ktb.co.th?quewadsas=2faddasdas'), 'ktb.co.th', 'get_domain_name()'); $this->unit->run(get_domain_name('http://www.studentloan.ktb.co.th/2011/20/01?=asdasdasdasd'), 'ktb.co.th', 'get_domain_name()'); $this->unit->run(get_domain_name('http://pantip.com/forum/siam'), 'pantip.com', 'get_domain_name()'); $this->unit->run(get_domain_name('http://www.wegointer.com/category/variety/'), 'wegointer.com', 'get_domain_name()'); $this->unit->run(get_domain_name(), 'lab.jojoee.com', 'get_domain_name()'); $this->unit->run(get_full_domain_name('http://www.wegointer.com/category/variety/'), 'www.wegointer.com', 'get_domain_name()'); $this->unit->run(get_full_domain_name('http://somedomain.co.uk'), 'somedomain.co.uk', 'get_full_domain_name()'); $this->unit->run(get_full_domain_name('http://www2.manager.co.th'), 'www2.manager.co.th', 'get_full_domain_name()'); $this->unit->run(get_full_domain_name('http://test.manager.co.th'), 'test.manager.co.th', 'get_full_domain_name()'); $this->unit->run(get_full_domain_name('http://manager.co.th'), 'manager.co.th', 'get_full_domain_name()'); $this->unit->run(get_full_domain_name('http://thaiware.com'), 'thaiware.com', 'get_full_domain_name()'); $this->unit->run(get_full_domain_name('http://www.thaiware.com'), 'www.thaiware.com', 'get_full_domain_name()'); $this->unit->run(get_full_domain_name('http://test.thaiware.com'), 'test.thaiware.com', 'get_full_domain_name()'); $this->unit->run(get_full_domain_name('http://www.studentloan.ktb.co.th/'), 'www.studentloan.ktb.co.th', 'get_full_domain_name()'); $this->unit->run(get_full_domain_name('http://www.studentloan.ktb.co.th/dasdasdasd.html'), 'www.studentloan.ktb.co.th', 'get_full_domain_name()'); $this->unit->run(get_full_domain_name('http://www.studentloan.ktb.co.th?quewadsas=2faddasdas'), 'www.studentloan.ktb.co.th', 'get_full_domain_name()'); $this->unit->run(get_full_domain_name('http://www.studentloan.ktb.co.th/2011/20/01?=asdasdasdasd'), 'www.studentloan.ktb.co.th', 'get_full_domain_name()'); $this->unit->run(get_full_domain_name('http://pantip.com/forum/siam'), 'pantip.com', 'get_full_domain_name()'); $this->unit->run(get_full_domain_name('http://www.wegointer.com/category/variety/'), 'www.wegointer.com', 'get_full_domain_name()'); $this->unit->run(get_full_domain_name(), 'lab.jojoee.com', 'get_full_domain_name()'); $url = 'http://sub.wegointer.com/category/variety/'; $this->unit->run(get_request_url($url, get_full_domain_name($url)), '/category/variety', 'get_request_url()'); $url = 'http://www.wegointer.com/category/variety/'; $this->unit->run(get_request_url($url, get_full_domain_name($url)), '/category/variety', 'get_request_url()'); $this->unit->run(get_full_url(), 'http://lab.jojoee.com/nn/test', 'get_full_url()'); // 404, 301 // $this->unit->run(is_url_exists('http://jojoee.com/404'), 'is_true', 'is_url_exists()'); // $this->unit->run(is_url_exists('http://fashion.spokedark.tv/2015/04/24/dichan-magazine/'), 'is_true', 'is_url_exists()'); // $this->unit->run(is_url_exists('http://www.jojoee.com/'), 'is_true', 'is_url_exists()'); // $this->unit->run(is_url_exists('http://test4041.com/'), 'is_false', 'is_url_exists()'); // $this->unit->run(is_url_exists('http://test4041.com/'), 'is_false', 'is_url_exists()'); // $this->unit->run(is_url_redirects('http://www.jojoee.com/'), 'is_true', 'is_url_exists()'); // $this->unit->run(is_404('http://jojoee.com/404'), 'is_true', 'is_404()'); // $url = 'http://fashion.spokedark.tv/?p=6600'; // $this->unit->run(is_url_exists($url), 'is_true', 'is_url_exists()'); // $this->unit->run(is_url_redirects($url), 'is_true', 'is_url_redirects()'); // don't know why it doesn't work // $url = 'http://movies.spokedark.tv?p=10054/'; // $this->unit->run(is_url_exists($url), 'is_true', 'is_url_exists()'); // $this->unit->run(is_url_redirects($url), 'is_true', 'is_url_redirects()'); $this->unit->run(get_extension('file.jpeg'), 'jpeg', 'get_extension()'); $this->unit->run(get_extension('file.bk.zip'), 'zip', 'get_extension()'); $this->unit->run(remove_trailing_slash('/category/product/'), '/category/product', 'remove_trailing_slash()'); $this->unit->run(remove_trailing_slash('/category/product'), '/category/product', 'remove_trailing_slash()'); $this->unit->run(remove_trailing_slash('category/product/'), 'category/product', 'remove_trailing_slash()'); for ($i = 0; $i < 20; $i++) { $urls = $this->get_posts(); foreach ($urls as $url) { $this->unit->run($url['is_publish'], '0', 'get_posts()'); } } }
function printQuickfinder(&$nav_items, &$quickfinder = '', $parent = '0') { foreach ($nav_items[$parent] as $row) { if (strpos($row['navi_item_link'], 'module=') === false && start_with('index.php?', $row['navi_item_link'])) { $row['navi_item_link'] .= '&doc=' . (empty($row['document_alias']) ? prepare_url($row['title']) : $row['document_alias']); } if (start_with('www.', $row['navi_item_link'])) { $row['navi_item_link'] = str_replace('www.', 'http://www.', $row['navi_item_link']); } $row['navi_item_link'] = rewrite_link($row['navi_item_link']); if (!start_with('javascript:', $row['navi_item_link'])) { if ($row['navi_item_target'] == '_blank') { $row['navi_item_link'] = "javascript:window.open('" . $row['navi_item_link'] . "', '', '')"; } else { $row['navi_item_link'] = "window.location.href = '" . $row['navi_item_link'] . "'"; } } $quickfinder .= '<option class="level_' . $row['navi_item_level'] . '" value="' . $row['navi_item_link'] . '"' . ($row['active'] == 1 ? ' selected="selected"' : '') . '>' . pretty_chars($row['title']) . '</option>'; if (isset($nav_items[$row['Id']])) { printQuickfinder($nav_items, $quickfinder, $row['Id']); } } }
/** * Рекурсивная функция для формирования меню навигации * * @param string $navi * @param int $ebenen * @param string $way * @param int $rub * @param array $nav_items * @param string $row_ul * @param int $parent */ function printNavi(&$navi, &$ebenen, &$way, &$rub, &$nav_items, &$row_ul, $parent = 0) { $ebene = $nav_items[$parent][0]['navi_item_level']; switch ($ebene) { case 1: $navi .= $row_ul->navi_level1begin; break; case 2: $navi .= $row_ul->navi_level2begin; break; case 3: $navi .= $row_ul->navi_level3begin; break; } foreach ((array) $nav_items[$parent] as $row) { // $aktiv = (in_array($row['Id'], $way) || strpos($row['navi_item_link'], 'index.php?' . $_SERVER['QUERY_STRING']) !== false) ? 'aktiv' : 'inaktiv'; $aktiv = in_array($row['Id'], $way) ? 'aktiv' : 'inaktiv'; $akt = str_replace('[tag:linkname]', $row['title'], $ebenen[$ebene][$aktiv]); $akt = str_replace('[tag:linkid]', $row['Id'], $akt); if (strpos($row['navi_item_link'], 'module=') === false && start_with('index.php?', $row['navi_item_link'])) { if ($row['navi_item_link'] == 'index.php?id=1') { $akt = str_replace('[tag:link]', ABS_PATH, $akt); } else { $akt = str_replace('[tag:link]', $row['navi_item_link'] . "&doc=" . (empty($row['document_alias']) ? prepare_url($row['title']) : $row['document_alias']), $akt); } } else { // if (strpos($row['navi_item_link'], 'module=') === false) $row['navi_item_link'] = $row['navi_item_link'] . URL_SUFF; $akt = str_replace('[tag:link]', $row['navi_item_link'], $akt); if (start_with('www.', $row['navi_item_link'])) { $akt = str_replace('www.', 'http://www.', $akt); } } $navi .= str_replace('[tag:target]', $row['navi_item_target'], $akt); // $akt = str_replace('[tag:target]', $row['navi_item_target'], $akt); // $navi .= rewrite_link($akt); if (isset($nav_items[$row['Id']])) { printNavi($navi, $ebenen, $way, $rub, $nav_items, $row_ul, $row['Id']); } } switch ($ebene) { case 1: $navi .= $row_ul->navi_level1end; break; case 2: $navi .= $row_ul->navi_level2end; break; case 3: $navi .= $row_ul->navi_level3end; break; } }
/** * 发布一篇博客 * @param string $title 标题 * @param string $content 内容(html) */ protected function _publish($title, $content) { $url = "http://site.douban.com/widget/notes/{$this->blogname}/create"; $ret = $this->get($url); $ck = $this->getMatch1('#name="ck".*? value="(.*?)"#', $ret); $nid = $this->getMatch1('#name="note_id".*? value="(.*?)"#', $ret); if (empty($nid)) { return '模拟登录已过期或Widget ID填写错误!需重新<a href="bind.php">绑定账号</a>。'; } $param = array('ck' => $ck, 'note_id' => $nid, 'note_title' => $title, 'note_text' => $content, 'note_submit' => '发表'); if (preg_match_all('#<img .*?src="(.+?)".*?>#i', $content, $matches)) { foreach ($matches[1] as $img) { $mappath = UPLOAD_PATH . basename($img); $upload_data = array('image_file' => "@{$mappath}", 'note_id' => $nid, 'ct' => 'text', 'ck' => $ck); $this->referer = $url; $ret = $this->post("http://site.douban.com/j/note/add_photo", $upload_data, 'UTF-8', true); $seqid = $ret['photo']['seq']; if ($seqid) { $content = preg_replace('#<img .*?src="' . preg_quote($img) . '".*?>#i', "[图片{$seqid}]", $content); $param["p{$seqid}_layout"] = 'C'; $param["p{$seqid}_title"] = ''; } } } $param['note_text'] = preg_replace('#\\[(图片\\d+)\\]#', '<$1>', html_decode($content)); $ret = $this->post($url, $param); if (!$ret) { return '接口返回 NULL,一般是网络问题。'; } if (start_with($this->http_code, '40')) { return '模拟登录已过期!需重新<a href="bind.php">绑定账号</a>。'; } if (empty($this->http_header['Location'])) { Log::customLog('douban_site_error.txt', '发布失败:' . print_r($param, true) . print_r($this->http_header, true) . $ret); return '发布失败,详细原因请参阅<a href="_LOG/douban_site_error.txt" target="_blank">douban_site_error.log</a>。'; } else { if (str_contains($this->http_header['Location'], $nid)) { Log::customLog('douban_site_error.txt', '发布成功:' . print_r($param, true) . print_r($this->http_header, true) . $ret); return true; } } }
function is_support($file_name, $is_dir = true) { global $hidden_fullname, $hidden_partname, $allows; if (start_with($file_name, ".")) { return false; } if (in_array($file_name, $hidden_fullname)) { return false; } foreach ($hidden_partname as $keyword) { $ret = strpos($file_name, $keyword); if ($ret !== false) { return false; } } $ext = get_file_extension($file_name); if ($ext) { if (in_array($ext, $allows)) { return true; } else { return false; } } else { if ($is_dir) { return true; } else { return false; } } }
/** * Рекурсивная функция формирования карты сайта * * @param int $nav_items * @param string $sitemap * @param int $parent */ function printSitemap(&$nav_items, &$sitemap = '', $parent = 0) { $sitemap .= empty($sitemap) ? '<ul class="sitemap">' : '<ul>'; foreach ($nav_items[$parent] as $row) { if (strpos($row['navi_item_link'], 'module=') === false && start_with('index.php?', $row['navi_item_link'])) { $row['navi_item_link'] .= '&doc=' . (empty($row['document_alias']) ? prepare_url($row['title']) : $row['document_alias']); } if (start_with('www.', $row['navi_item_link'])) { $row['navi_item_link'] = str_replace('www.', 'http://www.', $row['navi_item_link']); } $row['navi_item_link'] = rewrite_link($row['navi_item_link']); $sitemap .= '<li><a href="' . $row['navi_item_link'] . '" target="' . $row['navi_item_target'] . '">'; $sitemap .= pretty_chars($row['title']) . '</a>'; if (isset($nav_items[$row['Id']])) { printSitemap($nav_items, $sitemap, $row['Id']); } $sitemap .= '</li>'; } $sitemap .= '</ul>'; }
/** * 发布一篇博客 * @param string $title 标题 * @param string $content 内容(html) */ protected function _publish($title, $content) { $rtk = $this->getMatch1("#get_check:'(.+?)'#", $this->get($this->getUrl())); if (empty($rtk)) { return '模拟登录已过期或个性域名填写错误!需重新<a href="bind.php">绑定账号</a>。'; } $url = "http://zhan.renren.com/{$this->blogname}/word/create"; if (preg_match_all('#<img .*?src="(.+?)".*?>#i', $content, $matches)) { foreach ($matches[1] as $img) { $mappath = UPLOAD_PATH . basename($img); $upload_data = array('theFile' => "@{$mappath}"); $this->referer = $url; $ret = $this->post("http://upload.renren.com/uploadblog.do", $upload_data, 'UTF-8', true); $ret = @json_decode($this->getMatch1('#\\[\\{(.*?)\\}\\]#', $ret), true); if ($ret[0] && $ret[0]['url']) { $content = str_replace($img, $ret[0]['url'], $content); } } } $param = array('subject' => $title, 'body' => $content, '_rtk' => $rtk); $ret = $this->post($url, $param); if (!$ret) { return '接口返回 NULL,一般是网络问题。'; } if (start_with($this->http_code, '40')) { return '模拟登录已过期!需重新<a href="bind.php">绑定账号</a>。'; } if ($ret['code'] != 0) { if ($ret['msg']) { return $ret['msg']; } else { Log::customLog('renren_zhan_error.txt', '发布失败:' . print_r($param, true) . print_r($this->http_header, true) . print_r($ret, true)); return '发布失败,详细原因请参阅<a href="_LOG/renren_zhan_error.txt" target="_blank">renren_zhan_error.log</a>。'; } } return true; }
<?php /** * 跳转到开放平台登录地址,RequestToken * @author 潘洪学 panliu888@gmail.com * @create_date 2011-10 */ include_once dirname(__FILE__) . DIRECTORY_SEPARATOR . '../init.php'; Passport::RequireLogin(); $type = $_GET['t']; $pid = intval($_GET['pid']); $api = Factory::CreateAPI($type, $pid); // 获取开放平台登录地址,跳转 switch ($api->type) { case 'kx001': $scope = 'send_feed create_records create_diary'; break; case 'renren': $scope = 'admin_page publish_blog'; break; } $cross = get_absolute_url('cross.php'); $auth_url = $api->GetAuthorizationUrl(get_absolute_url("bind.php?t={$type}&pid={$pid}&redir={$cross}", $api->callback), $scope); if (start_with($auth_url, 'http')) { redirect($auth_url); } else { echo $auth_url; }