1、登录授权部分(oauth)在application/controller/index/login.php的rAction头部加入
if (isset($_GET['url']) && !empty($_GET['url'])){
$_SESSION['get_url']=$_GET['url'];
}
public static function showmsg ( $msg , $gourl=-1 , $time = null , $button=false )
{
if (isset($_SESSION['get_url']) && !empty($_SESSION['get_url'])){
//echo $_SESSION['get_url'];
$redict_url=$_SESSION['get_url'];
unset($_SESSION['get_url']);
}
if ($time === null)
{
$time = Core_Config::get ('showtime' , 'basic' , 3);
}
$time > 1000 && $time = intval ($time / 1000);
$seogourl = $gourl;
if ($gourl == -1)
{
$seogourl = $gourl = empty($_SERVER['HTTP_REFERER'])?self::getUrlroot():$_SERVER['HTTP_REFERER'];
// $seogourl = $gourl = 'javascript:history.go(-1)';
}
elseif (!preg_match ('#^(https?|ftp)://#' , $gourl) && !preg_match ('/^javascript/' , $gourl))
{
$seogourl = Core_Template::seoChange ($gourl);
if(!preg_match('/^\//', $gourl))
{
$gourl = '/' . $gourl;
}
}
if (!$time)
{ #立即跳转
if (!preg_match ('/^javascript/' , $gourl))
{
//echo "立即跳转";die();
if (!empty($redict_url) && isset($redict_url)){
header ('Location: ' . $seogourl.'?redict_url='.$redict_url);
echo $meta = "<meta http-equiv=\"refresh\" content=\"{$time};url={$seogourl}\" />";
}else{
header ('Location: ' . $seogourl);
echo $meta = "<meta http-equiv=\"refresh\" content=\"{$time};url={$seogourl}\" />";
}
}
else
{
//echo "no立即跳转";die();
if (!empty($redict_url) && isset($redict_url)){
$seogourl=$seogourl.'?redict_url='.$redict_url;
$redict_url1=explode('"',$seogourl);
//print_r($redict_url1);
$redict_url_end=str_replace(';','',$redict_url1[2]);
$redict_urls=$redict_url1[0].'"'.$redict_url1[1].$redict_url_end.'"';
//echo str_replace("javascript:","",$redict_urls);die();
//localhost/upload/index.php/u/xiaozhu19891002"
echo "<script>" , str_replace("javascript:","",$redict_urls) , "</script>";
}else{
echo "<script>" , str_replace("javascript:","",$seogourl) , "</script>";
}
}
} else {
#延迟跳转
// echo "延迟跳转";//die();
Core_Template::assignvar('gourl' , $gourl);
Core_Template::assignvar('seogourl' , $seogourl);
Core_Template::assignvar('__msg' , $msg);
Core_Template::assignvar('msg' , $msg);
Core_Template::assignvar('time' , $time);
Core_Template::assignvar('button' , $button);
Core_Template::assignvar('_resource', Core_Config::get('resource_path','basic','/'));
Core_Template::assignvar('site_url', Core_Config::get('site_url','basic',false));
if (Core_Controller_Front::getInstance()->getModelName () == 'admin')
{
Core_Template::render ('admin/showmsg.tpl');
}
else
{
Core_Template::render ('index/showmsg.tpl');
}
}
exit;
}
private function index($name)
{
/*Controller_Api_Uc::indexAction();
return;*/
$msgCode = intval($this->getParam('msg'));
$msgCode && $this->assign('showmsg', Core_Comm_Modret::getMsg($msgCode));
if(Core_Config::get('useuc', 'basic', false) && isset($_SESSION['ucsynlogin']) && $_SESSION['ucsynlogin'])
{
//生成同步登录的代码
$ucsynlogin = Core_Outapi_Uc::call('user_synlogin', $_SESSION['uid']);
$this->assign('ucsynlogin', $ucsynlogin);
unset($_SESSION['ucsynlogin']);
}
//个人认证设置
$local = Core_Config::get('localauth', 'certification.info');
$platform = Core_Config::get('platformauth', 'certification.info');
$localtext = Core_Config::get('localauthtext', 'certification.info');
$authInfo = array('local' => $local, 'platform' => $platform, 'localtext' => $localtext);
$this->assign('auth', $authInfo);
if(strtolower($name) == strtolower($this->userInfo["name"])) //跳我的主页
{
$get_msg=$this->userInfo;
//主栏组件
$this->assign('mainComponent', Model_Componentprocessunit::getComponentWithHtml(1, 'main'));
//右栏组件
$this->assign('rightComponent', Model_Componentprocessunit::getComponentWithHtml(1, 'right'));
//如需拉取多个类型请|上(1|2) 得到3,type=3即可,填零表示拉取所有类型
$utype = Core_Comm_Validator::getNumArg($this->getParam("utype"), 0, 64, 0);
//Contenttype:内容过滤 填零表示所有类型 1-带文本 2-带链接 4图片 8-带视频 0x10-带音频
$ctype = Core_Comm_Validator::getNumArg($this->getParam("ctype"), 0, 16, 0);
$this->assign('utype', $utype);
$this->assign('ctype', $ctype);
Core_Lib_Base::clearNewMsgInfo(5);
//获取填充tbody
$this->getBody('index');
if (isset($_GET['redict_url']) && !empty($_GET['redict_url'])){
//print_r($_GET['redict_url']);die();
//echo $_GET['redict_url'];
//$this->assign('redict_url', $_GET['redict_url']);
echo $ucsynlogin;
echo '<script type="text/javascript">window.location.href="'.'http://'.$_GET['redict_url'];
echo '"; </script>';
return;
}
//激活样式
$this->assign('active', 'index');
// echo 'sb';die();
$this->display('user/index_test_timeline.tpl');
}
else //他人页
{
//获取显示用户资料
$guest = Model_User_Util::getFullInfo($name);
if(isset($guest['errormsg']))
{
Core_Fun::showmsg($guest['errormsg'],-1);
}
$guest['head'] = Core_Lib_Base::formatHead($guest['head'],120);
//拉取偶像列表, 只拉13个
$p = array("n" => $name, "num" => 12, "start" => 0, "type" => 1);
//获取偶像
$friendObj = Model_Friend::singleton();
$idols = $friendObj->getMyfriend($p);
$idollist = $idols["data"]["info"];
foreach($idollist as &$u)
{
$u['head'] = Core_Lib_Base::formatHead($u['head'], 50);
}
$this->getBody('guest', $name);
$utype = Core_Comm_Validator::getTidArg($this->getParam('utype'), '0');
$ctype = Core_Comm_Validator::getTidArg($this->getParam('ctype'), '0');
$url = '/u/' . $name;
//时间线类型
$filterlist = array(array('url' => $url, 'name' => '全部', 'utype' => '0'),
array('url' => $url . '/utype/1', 'name' => '原创', 'utype' => '1'),
array('url' => $url . '/utype/2', 'name' => '转播', 'utype' => '2'),
array('url' => $url . '/ctype/4', 'name' => '图片', 'ctype' => '4'),
array('url' => $url . '/ctype/8', 'name' => '视频', 'ctype' => '8'),
array('url' => $url . '/ctype/16', 'name' => '音乐', 'ctype' => '16'));
$this->assign('idollist', $idollist);
$this->assign('guest', $guest);
$this->assign('utype', $utype);
$this->assign('ctype', $ctype);
$this->assign('filterlist', $filterlist);
//激活样式
$this->assign('active', 'guest');
$this->display('index/guest_timeline.tpl');
}
}
if (isset($_GET['redict_url']) && !empty($_GET['redict_url'])){
//print_r($_GET['redict_url']);die();
//echo $_GET['redict_url'];
//$this->assign('redict_url', $_GET['redict_url']);
echo $ucsynlogin;
echo '<script type="text/javascript">window.location.href="'.'http://'.$_GET['redict_url'];
echo '"; </script>';
return;
}