Skip to content

Commit d53f6f7

Browse files
committed
目录迁移
1 parent 7326572 commit d53f6f7

File tree

169 files changed

+89
-531
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

169 files changed

+89
-531
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
/libs
22
/cache/
33
/static/pma/
4-
/static/uploads/
4+
/web/static/uploads/
55
/.idea/
66
*.log
7+
/web/index.html
8+
/server/cache
9+
/server/libs

script/templates/index.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -234,12 +234,12 @@
234234

235235
$db->connect($server, function ($db, $result) {
236236
$db->query("show tables", function (Swoole\MySQL $db, $result) {
237-
if ($r === false) {
237+
if ($result === false) {
238238
var_dump($db->error, $db->errno);
239-
} elseif ($r === true) {
239+
} elseif ($result === true) {
240240
var_dump($db->affected_rows, $db->insert_id);
241241
} else {
242-
var_dump($$result);
242+
var_dump($result);
243243
$db->close();
244244
}
245245
});

server/apps/configs/dev/db.php

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
<?php
22
$db['master'] = array(
3-
'type' => Swoole\Database::TYPE_MYSQLi, //Database Driver,可以选择PdoDB , MySQL, MySQL2(MySQLi) , AdoDb(需要安装adodb插件)
4-
'host' => SAE_MYSQL_HOST_M,
5-
'port' => SAE_MYSQL_PORT,
6-
'dbms' => 'mysql',
7-
'engine' => 'MyISAM',
8-
'user' => SAE_MYSQL_USER,
9-
'passwd' => SAE_MYSQL_PASS,
10-
'name' => 'wiki4swoole',
11-
'charset' => "utf8",
12-
'setname' => true,
3+
'type' => Swoole\Database::TYPE_MYSQLi, //Database Driver,可以选择PdoDB , MySQL, MySQL2(MySQLi) , AdoDb(需要安装adodb插件)
4+
'host' => '127.0.0.1',
5+
'dbms' => 'mysql',
6+
'engine' => 'MyISAM',
7+
'user' => 'root',
8+
'passwd' => 'root',
9+
'name' => 'wiki4swoole',
10+
'charset' => "utf8",
11+
'setname' => true,
1312
);
1413
return $db;

server/apps/configs/oauth.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,7 @@
33
$oauth['qq']['APP_ID'] = 221403;
44
$oauth['qq']['APP_KEY'] = 'f3f2490a725f75e154bf2a37773213b8';
55

6-
$oauth['renren']['Server_url'] = 'http://api.xiaonei.com/restserver.do';
7-
$oauth['renren']['APP_ID'] = 155895;
8-
$oauth['renren']['APP_KEY'] = '43328c1b5d984ed29f187d5631913708';
9-
$oauth['renren']['Secret'] = 'f5fb1fcba3f043ff8eb99dbfc1548816';
10-
116
$oauth['weibo']['appid'] = '1418646107';
127
$oauth['weibo']['skey'] = '8b1fed32df42548d71acac00dddb05bb';
138

14-
return $oauth;
9+
return $oauth;

server/apps/controllers/Page.php

Lines changed: 69 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -16,59 +16,54 @@ function __construct($swoole)
1616

1717
function verify()
1818
{
19-
session();
20-
$this->swoole->http->header('Content-Type', 'image/png');
21-
Swoole\Image::verifycode_gd();
19+
$this->session->start();
20+
$this->http->header('Content-Type', 'image/jpeg');
21+
$verifyCode = Swoole\Image::verifycode_gd();
22+
$_SESSION['authcode'] = $verifyCode['code'];
23+
return $verifyCode['image'];
2224
}
2325

24-
function test2()
26+
function oauth()
2527
{
2628
session();
27-
$_SESSION['test'] =1 ;
28-
var_dump($_SESSION);
29-
}
29+
if (empty($_GET['s']) or $_GET['s'] == 'sina')
30+
{
31+
$conf = $this->config['oauth']['weibo'];
32+
$oauth = new \WeiboOAuth($conf['appid'], $conf['skey']);
33+
$keys = $oauth->getRequestToken();
34+
$_SESSION['oauth_keys'] = $keys;
35+
$_SESSION['oauth_serv'] = 'sina';
36+
$login_url = $oauth->getAuthorizeURL($keys['oauth_token'], false, WEBROOT . '/page/oauth_callback/');
37+
$this->swoole->http->redirect($login_url);
38+
}
39+
elseif ($_GET['s'] == 'qq')
40+
{
3041

31-
function oauth()
32-
{
33-
session();
34-
if(empty($_GET['s']) or $_GET['s']=='sina')
35-
{
36-
$conf = $this->config['oauth']['weibo'];
37-
$oauth = new \WeiboOAuth($conf['appid'], $conf['skey']);
38-
$keys = $oauth->getRequestToken();
39-
$_SESSION['oauth_keys'] = $keys;
40-
$_SESSION['oauth_serv'] = 'sina';
41-
$login_url = $oauth->getAuthorizeURL($keys['oauth_token'],false,WEBROOT.'/page/oauth_callback/');
42-
$this->swoole->http->redirect($login_url);
43-
}
44-
elseif($_GET['s']=='qq')
45-
{
46-
47-
$conf = $this->config['oauth']['qq'];
48-
$oauth = new \QQOAuth($conf['APP_ID'], $conf['APP_KEY']);
49-
$token = $oauth->getRequestToken();
50-
$_SESSION['oauth_keys'] = $token;
51-
$_SESSION['oauth_serv'] = 'qq';
52-
$login_url = $oauth->getAuthorizeURL($token,WEBROOT.'/page/oauth_callback/');
42+
$conf = $this->config['oauth']['qq'];
43+
$oauth = new \QQOAuth($conf['APP_ID'], $conf['APP_KEY']);
44+
$token = $oauth->getRequestToken();
45+
$_SESSION['oauth_keys'] = $token;
46+
$_SESSION['oauth_serv'] = 'qq';
47+
$login_url = $oauth->getAuthorizeURL($token, WEBROOT . '/page/oauth_callback/');
5348
$this->swoole->http->redirect($login_url);
54-
}
55-
}
49+
}
50+
}
51+
5652
function oauth_callback()
5753
{
58-
session();
59-
if($_SESSION['oauth_serv']=='sina')
60-
{
61-
54+
session();
55+
if ($_SESSION['oauth_serv'] == 'sina')
56+
{
6257
$conf = $this->config['oauth']['weibo'];
6358
$oauth = new \WeiboOAuth($conf['appid'], $conf['skey'], $_SESSION['oauth_keys']['oauth_token'], $_SESSION['oauth_keys']['oauth_token_secret']);
6459
$_SESSION['last_key'] = $oauth->getAccessToken($_REQUEST['oauth_verifier']);
6560

66-
$client = new \WeiboClient($conf['appid'], $conf['skey'],$_SESSION['last_key']['oauth_token'],$_SESSION['last_key']['oauth_token_secret']);
67-
$userinfo = $client->verify_credentials();
68-
if(!isset($userinfo['id']))
61+
$client = new \WeiboClient($conf['appid'], $conf['skey'], $_SESSION['last_key']['oauth_token'],
62+
$_SESSION['last_key']['oauth_token_secret']);
63+
$userinfo = $client->verify_credentials();
64+
if (!isset($userinfo['id']))
6965
{
70-
var_dump($conf, $_SESSION);
71-
return "请求错误:".var_export($userinfo, true);
66+
return "请求错误:" . var_export($userinfo, $conf, $_SESSION, true);
7267
}
7368
$model = createModel('UserInfo');
7469
$username = 'sina_'.$userinfo['id'];
@@ -88,7 +83,7 @@ function oauth_callback()
8883
$_SESSION['user_id'] = $u['id'];
8984
$_SESSION['user'] = $u;
9085
$this->setLoginStat();
91-
$this->swoole->http->edirect(WEBROOT."/person/index/");
86+
$this->http->redirect(WEBROOT."/person/index/");
9287
}
9388
elseif($_SESSION['oauth_serv']=='qq')
9489
{
@@ -98,13 +93,17 @@ function oauth_callback()
9893
$oauth->getAccessToken($_GET['oauth_token'], $_SESSION['oauth_keys']['oauth_token_secret'], $_GET['oauth_vericode']);
9994

10095
$username = $oauth->access_token['openid'];
96+
10197
$model = createModel('UserInfo');
10298
$u = $model->get($username,'username')->get();
103-
//不存在,则插入数据库
104-
if(empty($u))
105-
{
106-
$user = $oauth->api_get('user/get_user_info');
107-
if(empty($user)) return Swoole\JS::js_back("请求错误");
99+
//不存在,则插入数据库
100+
if (empty($u))
101+
{
102+
$user = $oauth->api_get('user/get_user_info');
103+
if (empty($user))
104+
{
105+
return Swoole\JS::js_back("请求错误");
106+
}
108107

109108
$u['username'] = $username;
110109
$u['nickname'] = $user['nickname'];
@@ -117,9 +116,10 @@ function oauth_callback()
117116
$_SESSION['user_id'] = $u['id'];
118117
$_SESSION['user'] = $u;
119118
$this->setLoginStat();
120-
$this->swoole->http->redirect(WEBROOT."/person/index/");
119+
$this->http->redirect(WEBROOT."/person/index/");
121120
}
122121
}
122+
123123
function flist()
124124
{
125125
//Error::dbd();
@@ -208,8 +208,9 @@ function index()
208208
$gets['fid'] = 9;
209209
$model = createModel('News');
210210
$list = $model->gets($gets);
211-
211+
212212
$userlist = $this->getActiveUsers(50);
213+
213214
$this->swoole->tpl->assign('userlist', $userlist);
214215
$this->swoole->tpl->assign('list', $list);
215216
$this->swoole->tpl->display('index.html');
@@ -218,14 +219,15 @@ function index()
218219
{
219220
$page = $_GET['p'];
220221
$model = createModel('Cpage');
222+
221223
$det = $model->get($page,'pagename');
222224
$this->swoole->tpl->assign('det',$det);
223225
$this->swoole->tpl->display('index_page.html');
224226
}
225227
}
228+
226229
/**
227230
* 个人用户登录
228-
* @return unknown_type
229231
*/
230232
function login()
231233
{
@@ -330,8 +332,8 @@ function register()
330332
}
331333
else
332334
{
333-
require WEBPATH.'/dict/forms.php';
334-
$_forms['sex'] = Swoole\Form::radio('sex', $forms['sex']);
335+
$forms = require WEBPATH . '/dict/forms.php';
336+
$_forms['sex'] = Swoole\Form::radio('sex', $forms['sex']);
335337
//$_forms['level'] = Form::radio('php_level',$forms['level'],'');
336338
$this->swoole->tpl->assign('forms',$_forms);
337339
$this->swoole->tpl->display();
@@ -346,25 +348,26 @@ function chatroom()
346348
$this->swoole->tpl->assign('user',$userInfo->get($_SESSION['user_id'])->get());
347349
$this->swoole->tpl->display();
348350
}
351+
349352
/**
350353
* 忘记密码
351-
* @return unknown_type
352354
*/
353355
function forgot()
354-
{
355-
if($_POST)
356-
{
357-
$gets['realname'] = $_POST['realname'];
358-
$gets['username'] = $_POST['email'];
359-
$gets['mobile'] = $_POST['mobile'];
360-
$gets['select'] = 'id';
361-
$ul = $this->model->UserInfo->gets($gets);
362-
if(count($ul)!=0)
363-
{
364-
$password = App\Func::randomkeys(6);
365-
$this->model->UserInfo->set($ul[0]['id'],array('password'=>Auth::mkpasswd($gets['username'],$password)));
366-
App\Func::success('找回成功!','您的新密码是 <span style="color:#fe7e00;">'.$password.'</a>');
367-
}
356+
{
357+
if ($_POST)
358+
{
359+
$gets['realname'] = $_POST['realname'];
360+
$gets['username'] = $_POST['email'];
361+
$gets['mobile'] = $_POST['mobile'];
362+
$gets['select'] = 'id';
363+
$ul = $this->model->UserInfo->gets($gets);
364+
if (count($ul) != 0)
365+
{
366+
$password = App\Func::randomkeys(6);
367+
$this->model->UserInfo->set($ul[0]['id'],
368+
array('password' => Auth::mkpasswd($gets['username'], $password)));
369+
App\Func::success('找回成功!', '您的新密码是 <span style="color:#fe7e00;">' . $password . '</a>');
370+
}
368371
}
369372
else
370373
{

server/apps/templates/wiki/noframe/index.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
<script src="/static/js/jquery.js"></script>
2121
<script src="/static/js/dtree.js"></script>
2222
<title>{{$wiki_page.title}}-{{$project.name}}-Swoole文档中心</title>
23+
<meta name="description" content="Swoole, {{$wiki_page.title}}">
24+
<meta name="keywords" content="swoole, {{$wiki_page.title}}">
2325
</head>
2426
<body>
2527

File renamed without changes.

0 commit comments

Comments
 (0)