-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
134 changed files
with
25,830 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
########################## BAE application config file ###################### | ||
# | ||
# app.conf 采用YAML格式, 请参考 http://yaml.org/ | ||
# 请尽量不要在配置部分使用中文,以免发布失败 | ||
# 请不要使用TAB键,应该使用空格 | ||
# 一定要注意对齐,否则发布会失败 | ||
# app.conf 详细功能,请参考: | ||
# http://developer.baidu.com/wiki/index.php?title=docs/cplat/rt/manage/conf | ||
# http://godbae.duapp.com/?p=654 | ||
# | ||
############################################################################## | ||
|
||
handlers: | ||
- url : / | ||
script: index.php | ||
|
||
- expire : .jpg modify 10 years | ||
- expire : .swf modify 10 years | ||
- expire : .png modify 10 years | ||
- expire : .gif modify 10 years | ||
- expire : .JPG modify 10 years | ||
- expire : .ico modify 10 years |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?php | ||
header('Location:public_files/login.php'); | ||
?> | ||
<?php phpinfo(); ?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<?php | ||
class JpegThumbnail | ||
{ | ||
public $width; // maximum thumbnail width | ||
public $height; // maximum thumbnail height | ||
|
||
// intialize a new Thumbnail object | ||
public function __construct($width = 50, $height = 50) | ||
{ | ||
$this->width = $width; | ||
$this->height = $height; | ||
|
||
} | ||
// accept a source file location and return an open image handle or | ||
// save to disk if destination provided | ||
public function generate($src, $dest = '') | ||
{ | ||
//print($src); | ||
// retrive image dimensions | ||
list($width, $height) = getimagesize($src); | ||
|
||
//print($width); | ||
// determine if resize is necessary | ||
if(($lowest = min($this->width / $width, $this->height / $height)) < 1) | ||
{ | ||
$tmp = imagecreatefromjpeg($src); | ||
|
||
// resize | ||
$sm_width = floor($lowest * $width); | ||
$sm_height = floor($lowest * $height); | ||
$img = imagecreatetruecolor($sm_width, $sm_height); | ||
imagecopyresized($img, $tmp, 0,0, 0,0, $sm_width, $sm_height, | ||
$width, $height); | ||
imagedestroy($tmp); | ||
$finimg = new SaeImage(); | ||
$finimg->setData($img); | ||
} | ||
// image is already thumbnail size and resize not necessary | ||
else | ||
{ | ||
$img = imagecreatefromjpeg($src); | ||
$finimg = new SaeImage(); | ||
$finimg->setData($img); | ||
} | ||
|
||
// save to disk or return the open image handle | ||
if ($dest) | ||
{ | ||
$s = new SaeStorage(); | ||
$s->write('smallform',$dest,$finimg->exec()); | ||
//imagejpeg($img, $dest, 100); | ||
imagedestroy($img); | ||
} | ||
else | ||
{ | ||
return $img; | ||
} | ||
} | ||
} | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,163 @@ | ||
<?php | ||
require_once 'YqBase.php'; | ||
class Message extends YqBase { | ||
private $collection; | ||
// static $conn; // 连接 | ||
// function __construct() { | ||
// try { | ||
// if (self::$conn == null) { | ||
// self::$conn = connectDb (); | ||
// } | ||
// self::$conn->connect (); | ||
// } catch ( Exception $e ) { | ||
// self::$conn = connectDb (); | ||
// } | ||
// while ( 1 ) { | ||
// $this->db = self::$conn->selectDB ( $this->dbname ); | ||
// if ($this->user != '' && $this->pwd != '') { | ||
// $fa = $this->db->authenticate ( $this->user, $this->pwd ); | ||
// if ($fa ['ok'] == 0) { | ||
// sleep ( 1 ); | ||
// continue; | ||
// } | ||
// } | ||
// break; | ||
// } | ||
// if (! isset ( $_SESSION )) { | ||
// session_start (); | ||
// } | ||
// $this->yiquan_version = $this->checkagent (); | ||
// } | ||
// function __destruct() { | ||
// self::$conn->close (); | ||
// } | ||
// 此类用于 message 表 | ||
// private $dbname = 'test'; | ||
// private $table = 'topic'; | ||
|
||
// message的属性: | ||
// sender_id | ||
// receiver_id | ||
// life | ||
// labels | ||
// type | ||
// postTime | ||
// title | ||
function addMessage($message_senderId, $message_receiverId, $message_type, $message_title, $message_labels, $message_topicID,$message_topicTitle) { | ||
if ($this->yiquan_version == 0) { | ||
return - 2; | ||
} | ||
|
||
if ($this->checkToken () == 0) { | ||
return - 3; | ||
} | ||
$this->logCallMethod ( $this->getCurrentUsername (), __METHOD__ ); | ||
$message_postTime = time (); | ||
|
||
$m_labels = explode ( ',', $message_labels ); | ||
|
||
$data = array ( | ||
'message_senderId' => $message_senderId, | ||
'message_receiverId' => $message_receiverId, | ||
'message_type' => $message_type, | ||
'message_title' => $message_title, | ||
'message_life' => 1, | ||
'message_postTime' => $message_postTime, | ||
'message_labels' => $m_labels, | ||
'message_topicID' => $message_topicID, | ||
'message_topicTitle' => $message_topicTitle | ||
|
||
|
||
); | ||
|
||
|
||
try { | ||
$cursor = $this->db->message->findOne ( | ||
array ( | ||
'message_receiverId' => $message_receiverId, | ||
'message_topicID' => $message_topicID, | ||
'message_type' => 'newReply', | ||
'message_life' => 1 | ||
) | ||
); | ||
if ( $cursor == NULL ) { | ||
$result = $this->db->message->insert ( $data ); | ||
return 1; | ||
} | ||
else | ||
return 0; | ||
|
||
} catch ( Exception $e ) { | ||
return - 1; | ||
} | ||
} | ||
|
||
// 查询用户收到的 | ||
function queryMessageByName($message_receiverId,$time) { | ||
try { | ||
if ($this->yiquan_version == 0) { | ||
return - 2; | ||
} | ||
|
||
if ($this->checkToken () == 0) { | ||
return - 3; | ||
} | ||
$this->logCallMethod ( $this->getCurrentUsername (), __METHOD__ ); | ||
$time = ( int ) $time; | ||
$result = $this->db->message->find ( array ( | ||
'message_receiverId' => $message_receiverId, | ||
'message_postTime' => array ( | ||
'$lt' => $time | ||
), | ||
'message_life' => 1 | ||
|
||
) )->sort ( array ( | ||
'message_postTime' => - 1 | ||
) ); | ||
$count = 0; | ||
$res = array (); | ||
foreach ( $result as $key => $value ) { | ||
$user = $this->db->user->findOne ( array ( | ||
'user_name' => $value ['message_senderId'] | ||
) ); | ||
$value ['sender_nickname'] = $user ['user_nickname']; | ||
$value ['sender_pic'] = $user ['user_pic']; | ||
array_push ( $res, $value ); | ||
if ($count >= 30) { | ||
break; | ||
} else { | ||
$count ++; | ||
} | ||
} | ||
return json_encode ( $res ); | ||
} catch ( Exception $e ) { | ||
return - 1; | ||
} | ||
} | ||
// 表示用户收到了数据(就是查看了) | ||
function readMessage($message_id) { | ||
try { | ||
if ($this->yiquan_version == 0) { | ||
return - 2; | ||
} | ||
|
||
if ($this->checkToken () == 0) { | ||
return - 3; | ||
} | ||
$this->logCallMethod ( $this->getCurrentUsername (), __METHOD__ ); | ||
$result = $this->db->message->update ( array ( | ||
'_id' => new Mongoid ( $message_id ) | ||
), // 条件 | ||
array ( | ||
'$set' => array ( | ||
'message_life' => 0 | ||
) | ||
) ); // 把life set为0 | ||
|
||
return 1; | ||
} catch ( Exception $e ) { | ||
return - 1; | ||
} | ||
} | ||
} | ||
?> |
Oops, something went wrong.