@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
defined('IN_TS') or die('Access Denied.');
|
||||
|
||||
//管理入口
|
||||
|
||||
if(is_file('app/'.$app.'/action/admin/'.$mg.'.php')){
|
||||
include_once 'app/'.$app.'/action/admin/'.$mg.'.php';
|
||||
}else{
|
||||
qiMsg('sorry:no index!');
|
||||
}
|
||||
@@ -0,0 +1,219 @@
|
||||
<?php
|
||||
defined('IN_TS') or die('Access Denied.');
|
||||
|
||||
switch($ts){
|
||||
case "list":
|
||||
|
||||
$page = tsIntval($_GET['page'],1);
|
||||
|
||||
$lstart = $page*10-10;
|
||||
|
||||
$url = SITE_URL.'index.php?app=photo&ac=admin&mg=album&ts=list&page=';
|
||||
|
||||
$arrAlbum = $new['photo']->findAll('photo_album',null,'albumid desc',null,$lstart.',10');
|
||||
|
||||
|
||||
$albumNum = $new['photo']->findCount('photo_album');
|
||||
|
||||
|
||||
$pageUrl = pagination($albumNum, 10, $page, $url);
|
||||
|
||||
include template("admin/album_list");
|
||||
break;
|
||||
|
||||
//图片
|
||||
case "photo":
|
||||
$albumid = tsIntval($_GET['albumid']);
|
||||
|
||||
$page = tsIntval($_GET['page'],1);
|
||||
|
||||
$lstart = $page*10-10;
|
||||
|
||||
$url = SITE_URL.'index.php?app=photo&ac=admin&mg=album&ts=photo&albumid='.$albumid.'&page=';
|
||||
|
||||
$arrPhoto = $db->fetch_all_assoc("select * from ".dbprefix."photo where albumid='$albumid' limit $lstart,10");
|
||||
|
||||
$photo_num = $db->once_fetch_assoc("select count(photoid) from ".dbprefix."photo where albumid='$albumid'");
|
||||
|
||||
$pageUrl = pagination($photo_num['count(photoid)'], 10, $page, $url);
|
||||
|
||||
include template("admin/album_photo");
|
||||
|
||||
break;
|
||||
|
||||
//删除相册
|
||||
case "del_album":
|
||||
$albumid = tsIntval($_GET['albumid']);
|
||||
|
||||
$new['photo']->deletePhotoAlbum($albumid);
|
||||
|
||||
qiMsg("相册删除成功!");
|
||||
|
||||
break;
|
||||
|
||||
//删除照片
|
||||
case "del_photo":
|
||||
$photoid = tsIntval($_GET['photoid']);
|
||||
|
||||
$strPhoto = $new['photo']->find('photo',array(
|
||||
'photoid'=>$photoid,
|
||||
));
|
||||
|
||||
$albumid = $strPhoto['albumid'];
|
||||
|
||||
$new['photo']->deletePhoto($strPhoto);
|
||||
|
||||
$count_photo = $db->once_num_rows("select * from ".dbprefix."photo where albumid='$albumid'");
|
||||
|
||||
$db->query("update ".dbprefix."photo_album set `count_photo`='$count_photo' where albumid='$albumid'");
|
||||
|
||||
qiMsg("图片删除成功!");
|
||||
|
||||
break;
|
||||
|
||||
//设为封面
|
||||
case "face":
|
||||
$photoid = tsIntval($_GET['photoid']);
|
||||
$strPhoto = $db->once_fetch_assoc("select * from ".dbprefix."photo where photoid='$photoid'");
|
||||
|
||||
$albumid = $strPhoto['albumid'];
|
||||
$albumface = $strPhoto['photourl'];
|
||||
|
||||
$db->query("update ".dbprefix."photo_album set `albumface`='$albumface' where albumid='$albumid'");
|
||||
|
||||
qiMsg("封面设置成功!");
|
||||
|
||||
break;
|
||||
|
||||
//统计
|
||||
case "count":
|
||||
|
||||
$arrAlbum = $db->fetch_all_assoc("select albumid from ".dbprefix."photo_album");
|
||||
|
||||
foreach($arrAlbum as $item){
|
||||
$albumid = $item['albumid'];
|
||||
$count_photo = $db->once_num_rows("select photoid from ".dbprefix."photo where albumid='$albumid'");
|
||||
$db->query("update ".dbprefix."photo_album set `count_photo`='$count_photo' where albumid='$albumid'");
|
||||
}
|
||||
|
||||
qiMsg("统计完成!");
|
||||
|
||||
break;
|
||||
|
||||
//推荐相册
|
||||
case "isrecommend":
|
||||
|
||||
$albumid = tsIntval($_GET['albumid']);
|
||||
|
||||
$strAlbum = $db->once_fetch_assoc("select isrecommend from ".dbprefix."photo_album where `albumid`='$albumid'");
|
||||
|
||||
if($strAlbum['isrecommend']==0){
|
||||
$db->query("update ".dbprefix."photo_album set `isrecommend`='1' where `albumid`='$albumid'");
|
||||
}else{
|
||||
$db->query("update ".dbprefix."photo_album set `isrecommend`='0' where `albumid`='$albumid'");
|
||||
}
|
||||
|
||||
qiMsg("操作成功!");
|
||||
|
||||
break;
|
||||
|
||||
//是否审核
|
||||
case "isaudit":
|
||||
|
||||
$albumid = tsIntval($_GET['albumid']);
|
||||
|
||||
$strAlbum = $new['photo']->find('photo_album',array(
|
||||
'albumid'=>$albumid,
|
||||
));
|
||||
|
||||
if($strAlbum['isaudit']==0){
|
||||
|
||||
$new['photo']->update('photo_album',array(
|
||||
'albumid'=>$albumid,
|
||||
),array(
|
||||
'isaudit'=>1,
|
||||
));
|
||||
|
||||
}else{
|
||||
$new['photo']->update('photo_album',array(
|
||||
'albumid'=>$albumid,
|
||||
),array(
|
||||
'isaudit'=>0,
|
||||
));
|
||||
}
|
||||
|
||||
qiMsg("操作成功!");
|
||||
|
||||
break;
|
||||
|
||||
//删除没有图片的相册
|
||||
case "nophoto":
|
||||
|
||||
$arrAlbum = $new['photo']->findAll('photo_album',"`count_photo`=0");
|
||||
foreach($arrAlbum as $key=>$item){
|
||||
|
||||
$isPhoto = $new['photo']->findCount('photo',array(
|
||||
'albumid'=>$item['albumid'],
|
||||
));
|
||||
|
||||
if($isPhoto == 0){
|
||||
|
||||
$new['photo']->delete('photo_album',array(
|
||||
|
||||
'albumid'=>$item['albumid'],
|
||||
|
||||
));
|
||||
|
||||
}else{
|
||||
|
||||
$count_photo = $new['photo']->findCount('photo',array(
|
||||
|
||||
'albumid'=>$item['albumid'],
|
||||
|
||||
));
|
||||
|
||||
$new['photo']->update('photo_album',array(
|
||||
'albumid'=>$item['albumid'],
|
||||
),array(
|
||||
|
||||
'count_photo'=>$count_photo,
|
||||
|
||||
));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
qiMsg('操作成功!');
|
||||
|
||||
break;
|
||||
|
||||
case "isaudit":
|
||||
|
||||
$albumid = tsIntval($_GET['albumid']);
|
||||
|
||||
$strAlbum = $new['attach']->find('photo_album',array(
|
||||
'albumid'=>$albumid,
|
||||
));
|
||||
|
||||
if($strAlbum['isaudit']==1){
|
||||
$new['attach']->update('photo_album',array(
|
||||
'albumid'=>$albumid,
|
||||
),array(
|
||||
'isaudit'=>0
|
||||
));
|
||||
}
|
||||
|
||||
if($strAlbum['isaudit']==0){
|
||||
$new['attach']->update('photo_album',array(
|
||||
'albumid'=>$albumid,
|
||||
),array(
|
||||
'isaudit'=>1
|
||||
));
|
||||
}
|
||||
|
||||
qiMsg('操作成功!');
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
defined('IN_TS') or die('Access Denied.');
|
||||
|
||||
switch ($ts){
|
||||
|
||||
case "list":
|
||||
|
||||
$userid = intval($_GET['userid']);
|
||||
$photoid = intval($_GET['photoid']);
|
||||
|
||||
$page = isset($_GET['page']) ? intval($_GET['page']) : 1;
|
||||
$url = SITE_URL.'index.php?app=photo&ac=admin&mg=comment&ts=list&page=';
|
||||
$lstart = $page*10-10;
|
||||
|
||||
$where = null;
|
||||
|
||||
if($userid){
|
||||
$where = array(
|
||||
'userid'=>$userid,
|
||||
);
|
||||
}
|
||||
|
||||
if($photoid){
|
||||
$where = array(
|
||||
'photoid'=>$photoid,
|
||||
);
|
||||
}
|
||||
|
||||
$arrComment = $new['photo']->findAll('photo_comment',$where,'addtime desc',null,$lstart.',10');
|
||||
|
||||
$commentNum = $new['photo']->findCount('photo_comment',$where);
|
||||
|
||||
$pageUrl = pagination($commentNum, 10, $page, $url);
|
||||
|
||||
include template("admin/comment_list");
|
||||
|
||||
break;
|
||||
|
||||
|
||||
case "delete":
|
||||
|
||||
$commentid = intval($_GET['commentid']);
|
||||
|
||||
$strComment = $new['photo']->find('photo_comment',array(
|
||||
'commentid'=>$commentid,
|
||||
));
|
||||
|
||||
$new['photo']->delete('photo_comment',array(
|
||||
'commentid'=>$commentid,
|
||||
));
|
||||
|
||||
#统计评论数
|
||||
$count_comment = $new['photo']->findCount('photo_comment',array(
|
||||
'photoid'=>$strComment['photoid'],
|
||||
));
|
||||
|
||||
//更新评论数
|
||||
$new['photo']->update('photo',array(
|
||||
'photoid'=>$strComment['photoid'],
|
||||
),array(
|
||||
'count_comment'=>$count_comment,
|
||||
));
|
||||
|
||||
|
||||
#处理积分
|
||||
aac('user') -> doScore($TS_URL['app'], $TS_URL['ac'], $TS_URL['ts'],$strComment['userid'],$TS_URL['mg']);
|
||||
|
||||
qiMsg('删除成功');
|
||||
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
defined('IN_TS') or die('Access Denied.');
|
||||
|
||||
switch($ts){
|
||||
//基本配置
|
||||
case "":
|
||||
$strOption = getAppOptions('photo');
|
||||
|
||||
include template("admin/options");
|
||||
|
||||
break;
|
||||
|
||||
case "do":
|
||||
|
||||
$arrOption = $_POST['option'];
|
||||
|
||||
#更新app配置选项
|
||||
upAppOptions('photo',$arrOption);
|
||||
|
||||
#更新app导航和我的导航
|
||||
upAppNav('photo',$arrOption['appname']);
|
||||
|
||||
qiMsg('修改成功!');
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
defined('IN_TS') or die('Access Denied.');
|
||||
|
||||
switch($ts){
|
||||
|
||||
case "":
|
||||
|
||||
$ugid = tsIntval($_GET['ugid'],1);
|
||||
|
||||
$arrUg = $new['photo']->findAll('user_group',null,'ugid asc');
|
||||
|
||||
|
||||
|
||||
|
||||
include template('admin/permissions');
|
||||
|
||||
break;
|
||||
|
||||
case "do":
|
||||
|
||||
/**
|
||||
* 权限参数说明,app,action必须,其他参数可选
|
||||
* app-action-ts
|
||||
* app-action-mg-ts 当action=admin
|
||||
* app-action-api-ts 当action=api
|
||||
*/
|
||||
|
||||
$ugid = tsIntval($_POST['ugid']);
|
||||
|
||||
$arrOption = $_POST['option'];
|
||||
|
||||
aac('pubs')->upAppPermissions($ugid,'photo',$arrOption);
|
||||
|
||||
qiMsg('操作成功!');
|
||||
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
defined('IN_TS') or die('Access Denied.');
|
||||
|
||||
switch($ts){
|
||||
|
||||
case "list":
|
||||
|
||||
$page = tsIntval($_GET['page'],1);
|
||||
|
||||
$lstart = $page*10-10;
|
||||
|
||||
$url = SITE_URL.'index.php?app=photo&ac=admin&mg=photo&ts=list&page=';
|
||||
|
||||
$arrPhoto = $db->fetch_all_assoc("select * from ".dbprefix."photo order by addtime desc limit $lstart,10");
|
||||
|
||||
$photoNum = $db->once_fetch_assoc("select count(*) from ".dbprefix."photo");
|
||||
|
||||
$pageUrl = pagination($photoNum['count(*)'], 10, $page, $url);
|
||||
|
||||
include template("admin/photo_list");
|
||||
break;
|
||||
|
||||
//推荐图片
|
||||
case "isrecommend":
|
||||
|
||||
$photoid = tsIntval($_GET['photoid']);
|
||||
|
||||
$strPhoto = $db->once_fetch_assoc("select isrecommend from ".dbprefix."photo where `photoid`='$photoid'");
|
||||
|
||||
if($strPhoto['isrecommend']==0){
|
||||
$db->query("update ".dbprefix."photo set `isrecommend`='1' where `photoid`='$photoid'");
|
||||
}else{
|
||||
$db->query("update ".dbprefix."photo set `isrecommend`='0' where `photoid`='$photoid'");
|
||||
}
|
||||
|
||||
qiMsg("操作成功!");
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,157 @@
|
||||
<?php
|
||||
defined('IN_TS') or die('Access Denied.');
|
||||
|
||||
$userid = tsIntval($TS_USER['userid']);
|
||||
|
||||
if($userid==0){
|
||||
return false;
|
||||
exit;
|
||||
}
|
||||
|
||||
switch($ts){
|
||||
|
||||
//普通上传
|
||||
case "upload":
|
||||
|
||||
//包含模版
|
||||
include template("ajax/upload");
|
||||
|
||||
break;
|
||||
|
||||
//
|
||||
case "net":
|
||||
include template("ajax/net");
|
||||
break;
|
||||
|
||||
//Flash上传
|
||||
case "flash":
|
||||
|
||||
$albumid = tsIntval($_GET['albumid']);
|
||||
$addtime = time();
|
||||
|
||||
include template("ajax/flash");
|
||||
break;
|
||||
|
||||
//相册
|
||||
case "album":
|
||||
|
||||
$isAlbum = $new['photo']->findCount('photo_album',array(
|
||||
|
||||
'userid'=>$userid,
|
||||
|
||||
));
|
||||
|
||||
if($isAlbum == 0){
|
||||
|
||||
$new['photo']->create('photo_album',array(
|
||||
|
||||
'userid'=>$userid,
|
||||
'albumname'=>'默认相册',
|
||||
'albumdesc'=>'默认相册',
|
||||
'addtime'=>time(),
|
||||
'uptime'=>time(),
|
||||
|
||||
|
||||
));
|
||||
|
||||
}
|
||||
|
||||
$arrAlbum = $new['photo']->findAll('photo_album',array(
|
||||
'userid'=>$userid,
|
||||
));
|
||||
|
||||
|
||||
include template("ajax/album");
|
||||
|
||||
break;
|
||||
//图片
|
||||
case "photo":
|
||||
|
||||
$albumid = tsIntval($_GET['albumid']);
|
||||
$strAlbum = $new['photo']->find('photo_album',array(
|
||||
'albumid'=>$albumid,
|
||||
));
|
||||
|
||||
$page = tsIntval($_GET['page'],1);
|
||||
$url = SITE_URL."index.php?app=photo&ac=ajax&ts=photo&albumid=".$albumid."&page=";
|
||||
$lstart = $page*6-6;
|
||||
|
||||
$arrPhoto = $new['photo']->findAll('photo',array(
|
||||
'albumid'=>$albumid,
|
||||
),'photoid desc',null,$lstart.',6');
|
||||
|
||||
$photoNum = $new['photo']->findCount('photo',array(
|
||||
'albumid'=>$albumid,
|
||||
));
|
||||
|
||||
$pageUrl = pagination($photoNum, 6, $page, $url);
|
||||
|
||||
include template("ajax/photo");
|
||||
break;
|
||||
//创建相册
|
||||
case "create":
|
||||
include template("ajax/create");
|
||||
break;
|
||||
|
||||
case "create_do":
|
||||
$albumname = t($_POST['albumname']);
|
||||
|
||||
if($albumname == '') qiMsg("相册名称不能为空!");
|
||||
|
||||
$albumdesc = h($_POST['albumdesc']);
|
||||
$addtime = time();
|
||||
$uptime = time();
|
||||
|
||||
$albumid = $new['photo']->create('photo_album',array(
|
||||
|
||||
'userid'=>$userid,
|
||||
'albumname'=>$albumname,
|
||||
'albumdesc'=>$albumdesc,
|
||||
'addtime'=>time(),
|
||||
'uptime'=>time(),
|
||||
|
||||
));
|
||||
|
||||
header("Location: ".SITE_URL."index.php?app=photo&ac=ajax&ts=flash&albumid=".$albumid);
|
||||
break;
|
||||
|
||||
//
|
||||
case "info":
|
||||
$albumid = tsIntval($_GET['albumid']);
|
||||
$addtime = tsIntval($_GET['addtime']);
|
||||
|
||||
$strAlbum = $new['photo']->find('photo_album',array(
|
||||
'albumid'=>$albumid,
|
||||
));
|
||||
|
||||
if($strAlbum['userid'] != $userid) qiMsg("非法操作!");
|
||||
|
||||
//统计
|
||||
$count_photo = $new['photo']->findCount('photo',array(
|
||||
'albumid'=>$albumid,
|
||||
));
|
||||
|
||||
$new['photo']->update('photo_album',array(
|
||||
'albumid'=>$albumid,
|
||||
),array(
|
||||
'count_photo'=>$count_photo,
|
||||
));
|
||||
|
||||
//添加相册封面
|
||||
if($strAlbum['albumface'] == ''){
|
||||
|
||||
$strPhoto = $new['photo']->find('photo',"`albumid`='$albumid' and `userid`='$userid' and `addtime`>'$addtime'");
|
||||
|
||||
$new['photo']->update('photo_album',array(
|
||||
'albumid'=>$albumid,
|
||||
),array(
|
||||
'albumface'=>$strPhoto['photourl'],
|
||||
));
|
||||
|
||||
}
|
||||
|
||||
$arrPhoto = $new['photo']->findAll('photo',"`albumid`='$albumid' and `userid`='$userid' and `addtime`>'$addtime'");
|
||||
|
||||
include template("ajax/info");
|
||||
break;
|
||||
}
|
||||
@@ -0,0 +1,299 @@
|
||||
<?php
|
||||
defined('IN_TS') or die('Access Denied.');
|
||||
switch($ts){
|
||||
|
||||
//某一个相册
|
||||
case "":
|
||||
$albumid = tsIntval($_GET['id']);
|
||||
$strAlbum = $new['photo']->find('photo_album',array(
|
||||
'albumid'=>$albumid,
|
||||
));
|
||||
//404
|
||||
if($strAlbum==''){
|
||||
header("HTTP/1.1 404 Not Found");
|
||||
header("Status: 404 Not Found");
|
||||
$title = '404';
|
||||
include pubTemplate("404");
|
||||
exit;
|
||||
}
|
||||
|
||||
if($strAlbum['isaudit']==1){
|
||||
tsNotice('内容审核中...');
|
||||
}
|
||||
|
||||
$strAlbum['albumname'] = tsTitle($strAlbum['albumname']);
|
||||
$strAlbum['albumdesc'] = tsTitle($strAlbum['albumdesc']);
|
||||
|
||||
|
||||
$page = tsIntval($_GET['page'],1);
|
||||
|
||||
$url = tsUrl('photo','album',array('id'=>$albumid,'page'=>''));
|
||||
|
||||
$lstart = $page*20-20;
|
||||
|
||||
$strUser = aac('user')->getSimpleUser($strAlbum['userid']);
|
||||
|
||||
$arrPhoto = $new['photo']->findAll('photo',array(
|
||||
'albumid'=>$albumid,
|
||||
),'photoid desc',null,$lstart.',20');
|
||||
|
||||
foreach($arrPhoto as $key=>$item){
|
||||
$arrPhoto[$key]['photodesc'] = tsTitle($item['photodesc']);
|
||||
}
|
||||
|
||||
$photoNum = $new['photo']->findCount('photo',array(
|
||||
'albumid'=>$albumid,
|
||||
));
|
||||
|
||||
$pageUrl = pagination($photoNum, 20, $page, $url);
|
||||
|
||||
|
||||
$title = $strAlbum['albumname'];
|
||||
|
||||
|
||||
include template("album");
|
||||
|
||||
$new['photo']->update('photo_album',array(
|
||||
'albumid'=>$strAlbum['albumid'],
|
||||
),array(
|
||||
'count_view'=>$strAlbum['count_view']+1,
|
||||
));
|
||||
|
||||
|
||||
break;
|
||||
|
||||
|
||||
//修改相册
|
||||
case "edit":
|
||||
|
||||
//用户是否登录
|
||||
$userid = aac('user')->isLogin();
|
||||
|
||||
$albumid = tsIntval($_GET['albumid']);
|
||||
|
||||
$strAlbum = $new['photo']->find('photo_album',array(
|
||||
'albumid'=>$albumid,
|
||||
));
|
||||
|
||||
if($strAlbum['userid'] == $userid || $TS_USER['isadmin']==1) {
|
||||
|
||||
$strAlbum['albumname'] = tsTitle($strAlbum['albumname']);
|
||||
$strAlbum['albumdesc'] = tsTitle($strAlbum['albumdesc']);
|
||||
|
||||
$title = '修改相册属性-'.$strAlbum['albumname'];
|
||||
include template("album_edit");
|
||||
|
||||
}else{
|
||||
|
||||
tsNotice('非法操作!');
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case "editdo":
|
||||
|
||||
//用户是否登录
|
||||
$userid = aac('user')->isLogin();
|
||||
|
||||
$albumid = tsIntval($_POST['albumid']);
|
||||
|
||||
$strAlbum = $new['photo']->find('photo_album',array(
|
||||
'albumid'=>$albumid,
|
||||
));
|
||||
|
||||
if($strAlbum['userid']==$userid || $TS_USER['isadmin']==1){
|
||||
|
||||
$albumname = tsTrim($_POST['albumname']);
|
||||
if($albumname == '') qiMsg("相册名称不能为空!");
|
||||
|
||||
$albumdesc = tsTrim($_POST['albumdesc']);
|
||||
|
||||
|
||||
if($TS_USER['isadmin']==0){
|
||||
//过滤内容开始
|
||||
$albumname = antiWord($albumname);
|
||||
$albumdesc = antiWord($albumdesc);
|
||||
//过滤内容结束
|
||||
}
|
||||
|
||||
$new['photo']->update('photo_album',array(
|
||||
'userid'=>$strAlbum['userid'],
|
||||
'albumid'=>$strAlbum['albumid'],
|
||||
),array(
|
||||
'albumname'=>$albumname,
|
||||
'albumdesc'=>$albumdesc,
|
||||
));
|
||||
|
||||
header("Location: ".tsUrl('photo','album',array('id'=>$albumid)));
|
||||
}else{
|
||||
tsNotice('非法操作!');
|
||||
}
|
||||
break;
|
||||
|
||||
//批量修改
|
||||
case "info":
|
||||
|
||||
//用户是否登录
|
||||
$userid = aac('user')->isLogin();
|
||||
|
||||
$albumid = tsIntval($_GET['albumid']);
|
||||
$addtime = tsIntval($_GET['addtime']);
|
||||
|
||||
$strAlbum = $new['photo']->find('photo_album',array(
|
||||
'albumid'=>$albumid,
|
||||
));
|
||||
|
||||
$strAlbum['albumname'] = tsTitle($strAlbum['albumname']);
|
||||
$strAlbum['albumdesc'] = tsTitle($strAlbum['albumdesc']);
|
||||
|
||||
if($strAlbum['userid'] != $userid) {
|
||||
|
||||
tsNotice('非法操作');
|
||||
|
||||
}
|
||||
|
||||
//统计
|
||||
$count_photo = $new['photo']->findCount('photo',array(
|
||||
'albumid'=>$albumid,
|
||||
));
|
||||
|
||||
$new['photo']->update('photo_album',array(
|
||||
'albumid'=>$albumid,
|
||||
),array(
|
||||
'count_photo'=>$count_photo,
|
||||
));
|
||||
|
||||
//添加相册封面
|
||||
if($strAlbum['albumface'] == ''){
|
||||
$strPhoto = $new['photo']->find('photo',array(
|
||||
'albumid'=>$strAlbum['albumid'],
|
||||
));
|
||||
|
||||
$new['photo']->update('photo_album',array(
|
||||
'albumid'=>$albumid,
|
||||
),array(
|
||||
'path'=>$strPhoto['path'],
|
||||
'albumface'=>$strPhoto['photourl'],
|
||||
));
|
||||
}
|
||||
|
||||
if($addtime){
|
||||
$arr = array(
|
||||
'albumid'=>$albumid,
|
||||
'addtime'=>date('Y-m-d H:i:s',$addtime),
|
||||
);
|
||||
}else{
|
||||
$arr = array(
|
||||
'albumid'=>$albumid,
|
||||
);
|
||||
}
|
||||
|
||||
$arrPhoto = $new['photo']->findAll('photo',$arr);
|
||||
|
||||
foreach($arrPhoto as $key=>$item){
|
||||
$arrPhoto[$key]['title'] = tsTitle($item['title']);
|
||||
$arrPhoto[$key]['photodesc'] = tsTitle($item['photodesc']);
|
||||
}
|
||||
|
||||
|
||||
$title = '批量修改-'.$strAlbum['albumname'];
|
||||
include template("album_info");
|
||||
break;
|
||||
|
||||
//批量修改执行
|
||||
case "info_do":
|
||||
|
||||
//用户是否登录
|
||||
$userid = aac('user')->isLogin();
|
||||
|
||||
$albumid = tsIntval($_POST['albumid']);
|
||||
|
||||
$albumface = tsIntval($_POST['albumface']);
|
||||
|
||||
$arrPhotoId = $_POST['photoid'];
|
||||
$arrPhotoDesc = $_POST['photodesc'];
|
||||
|
||||
|
||||
if(is_array($arrPhotoId)==false || is_array($arrPhotoDesc)==false){
|
||||
tsNotice('非法操作');
|
||||
}
|
||||
|
||||
|
||||
if($TS_USER['isadmin']==0){
|
||||
|
||||
foreach($arrPhotoDesc as $key=>$item){
|
||||
|
||||
//过滤内容开始
|
||||
$arrPhotoDesc[$key] = antiWord($item);
|
||||
//过滤内容结束
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
foreach($arrPhotoDesc as $key=>$item){
|
||||
|
||||
$item = str_replace('../','',$item);
|
||||
$item = str_replace('/','',$item);
|
||||
|
||||
if($item){
|
||||
|
||||
$photoid = tsIntval($arrPhotoId[$key]);
|
||||
|
||||
$new['photo']->update('photo',array(
|
||||
'photoid'=>$photoid,
|
||||
'userid'=>$userid,
|
||||
),array(
|
||||
|
||||
'photodesc'=>tsTrim($item),
|
||||
|
||||
));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//更新相册封面
|
||||
if (preg_match('#(..(\\|/)){2,}#sim', $albumface) != false) { die('request error');} #针对阿里云误报只能添加下
|
||||
if($albumface){
|
||||
|
||||
$strPhoto = $new['photo']->find('photo',array(
|
||||
'photoid'=>$albumface,
|
||||
));
|
||||
|
||||
$new['photo']->update('photo_album',array(
|
||||
'userid'=>$userid,
|
||||
'albumid'=>$albumid,
|
||||
),array(
|
||||
'path'=>$strPhoto['path'],
|
||||
'albumface'=>$strPhoto['photourl'],
|
||||
));
|
||||
}
|
||||
|
||||
header("Location: ".tsUrl('photo','album',array('id'=>$albumid)));
|
||||
|
||||
break;
|
||||
|
||||
//删除相册
|
||||
case "del":
|
||||
|
||||
//用户是否登录
|
||||
$userid = aac('user')->isLogin();
|
||||
|
||||
$albumid = tsIntval($_GET['albumid']);
|
||||
|
||||
$strAlbum = $new['photo']->find('photo_album',array(
|
||||
'albumid'=>$albumid,
|
||||
));
|
||||
|
||||
if($strAlbum['userid'] == $userid || $TS_USER['isadmin'] == 1) {
|
||||
|
||||
$new['photo']->deletePhotoAlbum($strAlbum['albumid']);
|
||||
|
||||
}
|
||||
|
||||
|
||||
header("Location: ".tsUrl('photo'));
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
defined ( 'IN_TS' ) or die ( 'Access Denied.' );
|
||||
|
||||
// api入口
|
||||
if (is_file ( 'app/' . $TS_URL['app'] . '/action/api/' . $TS_URL['api'] . '.php' )) {
|
||||
include_once 'app/' . $TS_URL['app'] . '/action/api/' . $TS_URL['api'] . '.php';
|
||||
} else {
|
||||
qiMsg ( 'sorry:no api!' );
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
defined('IN_TS') or die('Access Denied.');
|
||||
echo '<pre>
|
||||
-----------------------------------------------
|
||||
Photo Http Api List
|
||||
URL:https://demo.thinksaas.cn
|
||||
-----------------------------------------------
|
||||
-----------------------------------------------
|
||||
-----------------------------------------------
|
||||
-----------------------------------------------
|
||||
-----------------------------------------------
|
||||
-----------------------------------------------
|
||||
-----------------------------------------------
|
||||
-----------------------------------------------
|
||||
-----------------------------------------------
|
||||
-----------------------------------------------
|
||||
-----------------------------------------------
|
||||
-----------------------------------------------
|
||||
-----------------------------------------------
|
||||
-----------------------------------------------
|
||||
</pre>';
|
||||
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
defined('IN_TS') or die('Access Denied.');
|
||||
|
||||
//用户是否登录
|
||||
$userid = aac('user')->isLogin();
|
||||
|
||||
//判断发布者状态
|
||||
if(aac('user')->isPublisher()==false) tsNotice('不好意思,你还没有权限发布内容!');
|
||||
|
||||
//发布时间限制
|
||||
if(aac('system')->pubTime()==false) tsNotice('不好意思,当前时间不允许发布内容!');
|
||||
|
||||
switch($ts){
|
||||
|
||||
|
||||
case "":
|
||||
|
||||
$title = '创建相册';
|
||||
include template("create");
|
||||
|
||||
break;
|
||||
|
||||
case "do":
|
||||
|
||||
//用户是否登录
|
||||
$userid = aac('user')->isLogin();
|
||||
|
||||
$albumname = tsTrim($_POST['albumname']);
|
||||
$albumdesc = tsTrim($_POST['albumdesc']);
|
||||
|
||||
if($albumname == '') {
|
||||
tsNotice("相册名称不能为空!");
|
||||
}
|
||||
|
||||
//1审核后显示0不审核
|
||||
if ($TS_APP['isaudit']==1) {
|
||||
$isaudit = 1;
|
||||
} else {
|
||||
$isaudit = 0;
|
||||
}
|
||||
|
||||
if($TS_USER['isadmin']==0){
|
||||
//过滤内容开始
|
||||
$albumname = antiWord($albumname);
|
||||
$albumdesc = antiWord($albumdesc);
|
||||
//过滤内容结束
|
||||
}
|
||||
|
||||
$albumid = $new['photo']->create('photo_album',array(
|
||||
|
||||
'userid'=>$userid,
|
||||
'albumname'=>$albumname,
|
||||
'albumdesc'=>$albumdesc,
|
||||
'isaudit'=>$isaudit,
|
||||
'addtime'=>date('Y-m-d H:i:s'),
|
||||
'uptime'=>date('Y-m-d H:i:s'),
|
||||
|
||||
));
|
||||
|
||||
header("Location: ".tsUrl('photo','upload',array('albumid'=>$albumid)));
|
||||
|
||||
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
defined('IN_TS') or die('Access Denied.');
|
||||
//删除图片
|
||||
|
||||
//用户是否登录
|
||||
$userid = aac('user')->isLogin();
|
||||
|
||||
$photoid = tsIntval($_GET['photoid']);
|
||||
|
||||
$strPhoto = $new['photo']->find('photo',array(
|
||||
'photoid'=>$photoid,
|
||||
));
|
||||
|
||||
if($strPhoto['userid']==$userid || $TS_USER['isadmin']==1) {
|
||||
|
||||
|
||||
$albumid = $strPhoto['albumid'];
|
||||
|
||||
|
||||
$new['photo']->deletePhoto($strPhoto);
|
||||
|
||||
|
||||
$count_photo = $new['photo']->findCount('photo',array(
|
||||
'albumid'=>$albumid,
|
||||
));
|
||||
|
||||
$new['photo']->update('photo_album',array(
|
||||
|
||||
'albumid'=>$albumid,
|
||||
|
||||
),array(
|
||||
|
||||
'count_photo'=>$count_photo,
|
||||
|
||||
));
|
||||
|
||||
tsNotice('照片删除成功!','点击返回',tsUrl('photo','album',array('id'=>$albumid)));
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
<?php
|
||||
defined('IN_TS') or die('Access Denied.');
|
||||
switch($ts){
|
||||
|
||||
//删除照片
|
||||
case "photo_del":
|
||||
|
||||
//用户是否登录
|
||||
$userid = aac('user')->isLogin();
|
||||
|
||||
$photoid = intval($_GET['photoid']);
|
||||
|
||||
$strPhoto = $new['photo']->find('photo',array(
|
||||
'photoid'=>$photoid,
|
||||
));
|
||||
|
||||
if($strPhoto['userid']==$userid || $TS_USER['isadmin']==1) {
|
||||
|
||||
|
||||
$albumid = $strPhoto['albumid'];
|
||||
|
||||
unlink('uploadfile/photo/'.$strPhoto['photourl']);
|
||||
|
||||
$new['photo']->delete('photo',array(
|
||||
'photoid'=>$photoid,
|
||||
));
|
||||
|
||||
$count_photo = $new['photo']->findCount('photo',array(
|
||||
'albumid'=>$albumid,
|
||||
));
|
||||
|
||||
$new['photo']->update('photo_album',array(
|
||||
|
||||
'albumid'=>$albumid,
|
||||
|
||||
),array(
|
||||
|
||||
'count_photo'=>$count_photo,
|
||||
|
||||
));
|
||||
|
||||
tsNotice('照片删除成功!','点击返回',tsUrl('photo','album',array('id'=>$albumid)));
|
||||
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
//添加评论
|
||||
case "comment_do":
|
||||
|
||||
//用户是否登录
|
||||
$userid = aac('user')->isLogin();
|
||||
|
||||
$photoid = intval($_POST['photoid']);
|
||||
$content = trim($_POST['content']);
|
||||
|
||||
if($content==''){
|
||||
tsNotice('评论内容不能为空!');
|
||||
}
|
||||
|
||||
if($TS_USER['isadmin']==0){
|
||||
//过滤内容开始
|
||||
aac('system')->antiWord($content);
|
||||
//过滤内容结束
|
||||
}
|
||||
|
||||
$commentid = $new['photo']->create('photo_comment',array(
|
||||
'photoid'=> $photoid,
|
||||
'userid'=> $userid,
|
||||
'content'=> $content,
|
||||
'addtime'=> time(),
|
||||
));
|
||||
|
||||
header("Location: ".tsUrl('photo','show',array('id'=>$photoid)));
|
||||
|
||||
break;
|
||||
|
||||
//删除评论
|
||||
case "delcomment":
|
||||
|
||||
//用户是否登录
|
||||
$userid = aac('user')->isLogin();
|
||||
|
||||
$commentid = intval($_GET['commentid']);
|
||||
|
||||
$strComment = $new['photo']->find('photo_comment',array(
|
||||
'commentid'=>$commentid,
|
||||
));
|
||||
|
||||
$strPhoto = $new['photo']->find('photo',array(
|
||||
|
||||
'photoid'=>$strComment['photoid'],
|
||||
|
||||
));
|
||||
|
||||
|
||||
if($userid == $strPhoto['userid'] || $TS_USER['isadmin']=='1'){
|
||||
|
||||
$new['photo']->delete('photo_comment',array(
|
||||
'commentid'=>$commentid,
|
||||
));
|
||||
|
||||
tsNotice("删除评论成功!");
|
||||
|
||||
}else{
|
||||
tsNotice("非法操作!");
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
defined('IN_TS') or die('Access Denied.');
|
||||
//修改单个图片信息
|
||||
|
||||
$userid = aac('user')->isLogin();
|
||||
|
||||
switch($ts){
|
||||
|
||||
case "":
|
||||
|
||||
$photoid = tsIntval($_GET['photoid']);
|
||||
|
||||
$strPhoto = $new['photo']->find('photo',array(
|
||||
'photoid'=>$photoid,
|
||||
));
|
||||
|
||||
$strPhoto['title'] = tsTitle($strPhoto['title']);
|
||||
$strPhoto['photodesc'] = tsTitle($strPhoto['photodesc']);
|
||||
|
||||
if($strPhoto['userid']==$userid || $TS_USER['isadmin']==1){
|
||||
|
||||
$title = '修改图片信息';
|
||||
include template('photo_edit');
|
||||
|
||||
}else{
|
||||
|
||||
|
||||
tsNotice('非法操作!');
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
|
||||
case "do":
|
||||
|
||||
$photoid = tsIntval($_POST['photoid']);
|
||||
$title = tsTrim($_POST['title']);
|
||||
$photodesc = tsTrim($_POST['photodesc']);
|
||||
|
||||
$new['photo']->update('photo',array(
|
||||
'photoid'=>$photoid,
|
||||
),array(
|
||||
'title'=>$title,
|
||||
'photodesc'=>$photodesc,
|
||||
));
|
||||
|
||||
header('Location: '.tsUrl('photo','show',array('id'=>$photoid)));
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
defined('IN_TS') or die('Access Denied.');
|
||||
|
||||
$page = tsIntval($_GET['page'],1);
|
||||
|
||||
$url = tsUrl('photo','index',array('page'=>''));
|
||||
|
||||
$lstart = $page*30-30;
|
||||
|
||||
$arrAlbum = $new['photo']->findAll('photo_album',"`count_photo`>0 and `isaudit`=0",'albumid desc',null,$lstart.',30');
|
||||
|
||||
foreach($arrAlbum as $key=>$item){
|
||||
$arrAlbum[$key]['albumname'] = tstitle($item['albumname']);
|
||||
$arrAlbum[$key]['albumdesc'] = tstitle($item['albumdesc']);
|
||||
}
|
||||
|
||||
$albumNum = $new['photo']->findCount('photo_album',"`count_photo`>0 and `isaudit`=0");
|
||||
|
||||
$pageUrl = pagination($albumNum, 30, $page, $url);
|
||||
|
||||
$title = '最新专辑';
|
||||
|
||||
$sitekey = $TS_APP['appkey'];
|
||||
$sitedesc = $TS_APP['appdesc'];
|
||||
include template("index");
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
defined ( 'IN_TS' ) or die ( 'Access Denied.' );
|
||||
|
||||
// 我的入口
|
||||
if (is_file ( 'app/' . $TS_URL['app'] . '/action/my/' . $TS_URL['my'] . '.php' )) {
|
||||
$userid = aac('user')->isLogin();
|
||||
$strUser = aac('user')->getOneUser($userid);
|
||||
include_once 'app/' . $TS_URL['app'] . '/action/my/' . $TS_URL['my'] . '.php';
|
||||
} else {
|
||||
qiMsg ( 'sorry:no index!' );
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
defined('IN_TS') or die('Access Denied.');
|
||||
|
||||
$userid = aac('user')->isLogin();
|
||||
|
||||
$strUser = aac('user')->getOneUser($userid);
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
defined ( 'IN_TS' ) or die ( 'Access Denied.' );
|
||||
|
||||
|
||||
$page = tsIntval($_GET['page'],1);
|
||||
|
||||
$url = tsUrl('photo','my',array('my'=>'index','page'=>''));
|
||||
|
||||
$lstart = $page*6-6;
|
||||
|
||||
$arrAlbum = $new['photo']->findAll('photo_album',array(
|
||||
'userid'=>$strUser['userid'],
|
||||
),'albumid desc',null,$lstart.',6');
|
||||
|
||||
foreach($arrAlbum as $key=>$item){
|
||||
$arrAlbum[$key]['albumname'] = tsTitle($item['albumname']);
|
||||
$arrAlbum[$key]['albumdesc'] = tsTitle($item['albumdesc']);
|
||||
}
|
||||
|
||||
$albumNum = $new['photo']->findCount('photo_album',array(
|
||||
|
||||
'userid'=>$strUser['userid'],
|
||||
|
||||
));
|
||||
|
||||
$pageUrl = pagination($albumNum, 6, $page, $url);
|
||||
|
||||
$title = '我的相册';
|
||||
include template('my/index');
|
||||
@@ -0,0 +1,92 @@
|
||||
<?php
|
||||
defined('IN_TS') or die('Access Denied.');
|
||||
|
||||
$photoid = tsIntval($_GET['id']);
|
||||
|
||||
$strPhoto = $new['photo']->find('photo',array(
|
||||
'photoid'=>$photoid,
|
||||
));
|
||||
|
||||
//404
|
||||
if($strPhoto == ''){
|
||||
header("HTTP/1.1 404 Not Found");
|
||||
header("Status: 404 Not Found");
|
||||
$title = '404';
|
||||
include pubTemplate("404");
|
||||
exit;
|
||||
}
|
||||
|
||||
$strPhoto['title'] = tsTitle($strPhoto['title']);
|
||||
$strPhoto['photodesc'] = tsTitle($strPhoto['photodesc']);
|
||||
|
||||
#原图
|
||||
if($TS_SITE['file_upload_type']==1){
|
||||
#阿里云oss
|
||||
$strPhoto['photo_url'] = $TS_SITE['alioss_bucket_url'].'/uploadfile/photo/'.$strPhoto['photourl'];
|
||||
}else{
|
||||
#本地
|
||||
$strPhoto['photo_url'] = SITE_URL.'uploadfile/photo/'.$strPhoto['photourl'];
|
||||
}
|
||||
|
||||
$albumid = $strPhoto['albumid'];
|
||||
|
||||
//图片标签
|
||||
$strPhoto['tags'] = aac('tag')->getObjTagByObjid('photo', 'photoid', $strPhoto['photoid']);
|
||||
|
||||
//用户
|
||||
$strPhoto['user'] = aac('user')->getSimpleUser($strPhoto['userid']);
|
||||
|
||||
//相册下所有图片
|
||||
$arrPhoto = $new['photo']->findAll('photo',array(
|
||||
'albumid'=>$strPhoto['albumid'],
|
||||
),null,null,8);
|
||||
|
||||
//所在专辑
|
||||
$strAlbum = $new['photo']->find('photo_album',array(
|
||||
'albumid'=>$albumid,
|
||||
));
|
||||
|
||||
$strAlbum['albumname'] = tsTitle($strAlbum['albumname']);
|
||||
$strAlbum['albumdesc'] = tsTitle($strAlbum['albumdesc']);
|
||||
|
||||
$arrPhotoIds = $new['photo']->findAll('photo',array(
|
||||
|
||||
'albumid'=>$albumid,
|
||||
|
||||
),'photoid desc');
|
||||
|
||||
foreach($arrPhotoIds as $item){
|
||||
$arrPhotoId[] = $item['photoid'];
|
||||
}
|
||||
|
||||
rsort($arrPhotoId);
|
||||
|
||||
$nowkey = array_search($photoid,$arrPhotoId);
|
||||
$nowPage = $nowkey+1 ;
|
||||
$conutPage = count($arrPhotoId);
|
||||
$prev = $arrPhotoId[$nowkey - 1];
|
||||
$next = $arrPhotoId[$nowkey +1];
|
||||
|
||||
$userid = $strAlbum['userid'];
|
||||
$strUser = aac('user')->getSimpleUser($userid);
|
||||
|
||||
//评论列表
|
||||
$page = tsIntval($_GET['page'],1);
|
||||
$url = tsUrl('photo','show',array('id'=>$photoid,'page'=>''));
|
||||
$lstart = $page*15-15;
|
||||
$arrComment = aac('comment')->getCommentList('photo','photoid',$strPhoto['photoid'],$page,$lstart,$strPhoto['userid']);
|
||||
$commentNum = aac('comment')->getCommentNum('photo','photoid',$strPhoto['photoid']);
|
||||
$pageUrl = pagination($commentNum, 15, $page, $url);
|
||||
|
||||
|
||||
|
||||
$title = $strAlbum['albumname'].'(第'.$nowPage.'张)';
|
||||
|
||||
|
||||
include template("show");
|
||||
|
||||
$new['photo']->update('photo',array(
|
||||
'photoid'=>$strPhoto['photoid'],
|
||||
),array(
|
||||
'count_view'=>$strPhoto['count_view']+1,
|
||||
));
|
||||
@@ -0,0 +1,129 @@
|
||||
<?php
|
||||
defined('IN_TS') or die('Access Denied.');
|
||||
|
||||
switch($ts){
|
||||
|
||||
case "":
|
||||
|
||||
//用户是否登录
|
||||
$userid = aac('user')->isLogin();
|
||||
|
||||
//判断发布者状态
|
||||
if(aac('user')->isPublisher()==false) tsNotice('不好意思,你还没有权限发布内容!');
|
||||
|
||||
//发布时间限制
|
||||
if(aac('system')->pubTime()==false) tsNotice('不好意思,当前时间不允许发布内容!');
|
||||
|
||||
|
||||
$albumid = tsIntval($_GET['albumid']);
|
||||
|
||||
$strAlbum = $new['photo']->find('photo_album',array(
|
||||
'albumid'=>$albumid,
|
||||
));
|
||||
|
||||
$strAlbum['albumname'] = tsTitle($strAlbum['albumname']);
|
||||
$strAlbum['albumdesc'] = tsTitle($strAlbum['albumdesc']);
|
||||
|
||||
if($userid != $strAlbum['userid']) {
|
||||
|
||||
tsNotice('非法操作!');
|
||||
|
||||
}
|
||||
|
||||
$addtime = time();
|
||||
|
||||
$title = '上传照片';
|
||||
include template("upload");
|
||||
|
||||
break;
|
||||
|
||||
case "do":
|
||||
|
||||
$userid = aac('user')->isLogin();
|
||||
|
||||
$albumid = tsIntval($_POST['albumid']);
|
||||
|
||||
$addtime = tsIntval($_POST['addtime']);
|
||||
|
||||
if($albumid==0){
|
||||
getJson('非法操作1!');
|
||||
}
|
||||
|
||||
if($addtime==0){
|
||||
getJson('上传时间有误!');
|
||||
}
|
||||
|
||||
$strAlbum = $new['photo']->find('photo_album',array(
|
||||
'albumid'=>$albumid,
|
||||
));
|
||||
|
||||
if($strAlbum==''){
|
||||
getJson('非法操作2!');
|
||||
}
|
||||
|
||||
if($strAlbum['userid']!=$userid){
|
||||
getJson('非法操作3!');
|
||||
}
|
||||
|
||||
$type = getImagetype($_FILES['file']['tmp_name']);
|
||||
if(!in_array($type,array('jpg','gif','png','jpeg'))){
|
||||
getJson('非法操作4!');
|
||||
}
|
||||
|
||||
$photoid = $new['photo']->create('photo',array(
|
||||
'albumid'=>$strAlbum['albumid'],
|
||||
'userid'=>$strAlbum['userid'],
|
||||
'addtime' => date('Y-m-d H:i:s',$addtime),
|
||||
));
|
||||
|
||||
//上传
|
||||
$arrUpload = tsUpload($_FILES['file'],$photoid,'photo',array('jpg','png','jpeg','gif'));
|
||||
|
||||
if($arrUpload && $arrUpload['path'] && $arrUpload['url']){
|
||||
|
||||
$new['photo']->update('photo',array(
|
||||
'photoid'=>$photoid,
|
||||
),array(
|
||||
'title'=>$arrUpload['name'],
|
||||
'phototype'=>$arrUpload['type'],
|
||||
'path'=>$arrUpload['path'],
|
||||
'photourl'=>$arrUpload['url'],
|
||||
'photosize'=>$arrUpload['size'],
|
||||
));
|
||||
|
||||
|
||||
#生成对应大小的图片
|
||||
tsXimg($arrUpload['url'],'photo',320,320,$arrUpload['path'],1);
|
||||
tsXimg($arrUpload['url'],'photo',640,'',$arrUpload['path']);
|
||||
|
||||
|
||||
#统计相册图片数
|
||||
$count_photo = $new['photo']->findCount('photo',array(
|
||||
'albumid'=>$albumid,
|
||||
));
|
||||
|
||||
$new['photo']->update('photo_album',array(
|
||||
'albumid'=>$albumid,
|
||||
),array(
|
||||
'count_photo'=>$count_photo
|
||||
));
|
||||
|
||||
//对积分进行出来
|
||||
aac('user')->doScore($TS_URL['app'], $TS_URL['ac'],$TS_URL['mg'],$TS_URL['api'],$TS_URL['ts'],$strAlbum['userid']);
|
||||
|
||||
}else{
|
||||
|
||||
$new['photo']->delete('photo',array(
|
||||
'photoid'=>$photoid,
|
||||
));
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
#echo $photoid;
|
||||
getJson('上传成功!');
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
defined('IN_TS') or die('Access Denied.');
|
||||
|
||||
$userid = tsIntval($_GET['id']);
|
||||
|
||||
if($userid == 0) header("Location: ".SITE_URL."index.php");
|
||||
|
||||
$strUser = aac('user')->getSimpleUser($userid);
|
||||
|
||||
$page = tsIntval($_GET['page'],1);
|
||||
|
||||
$url = tsUrl('photo','user',array('id'=>$userid,'page'=>''));
|
||||
|
||||
$lstart = $page*6-6;
|
||||
|
||||
$arrAlbum = $new['photo']->findAll('photo_album',array(
|
||||
'userid'=>$userid,
|
||||
),'albumid desc',null,$lstart.',6');
|
||||
|
||||
foreach($arrAlbum as $key=>$item){
|
||||
$arrAlbum[$key]['albumname'] = tsTitle($item['albumname']);
|
||||
$arrAlbum[$key]['albumdesc'] = tsTitle($item['albumdesc']);
|
||||
}
|
||||
|
||||
$albumNum = $new['photo']->findCount('photo_album',array(
|
||||
'userid'=>$userid,
|
||||
));
|
||||
|
||||
$pageUrl = pagination($albumNum, 6, $page, $url);
|
||||
|
||||
|
||||
$title = $strUser['username'].'的相册';
|
||||
|
||||
include template("user");
|
||||
Reference in New Issue
Block a user