tsNotice('新Email帐号不能和旧Email帐号一样!'); } break; //必须上传头像 //必须上传头像 case "face": $userid = aac('user')->isLogin(); $strUser = $new['user']->getOneUser($userid); $title = '上传头像'; include template('verify_face'); break; case "facedo": $userid = aac('user')->isLogin(); if ($_FILES['picfile']) { //上传 $arrUpload = tsUpload($_FILES['picfile'], $userid, 'user', array('jpg', 'gif', 'png')); if ($arrUpload) { $new['user']->update('user_info', array('userid' => $userid), array('path' => $arrUpload['path'], 'face' => $arrUpload['url'])); $filesize = abs(filesize('uploadfile/user/' . $arrUpload['url'])); if ($filesize <= 0) { $new['user']->update('user_info', array('userid' => $userid), array('path' => '', 'face' => '')); tsNotice('上传头像失败!'); } else { //更新缓存头像 $_SESSION['tsuser']['face'] = $arrUpload['url']; $_SESSION['tsuser']['path'] = $arrUpload['path']; tsDimg($arrUpload['url'], 'user', '120', '120', $arrUpload['path']); header('Location: ' . tsUrl('user', 'verify', array('ts' => 'face'))); } } else { tsNotice('头像修改失败');
case "": $title = '发布活动'; include template("add"); break; case "do": $title = trim($_POST['title']); $typeid = intval($_POST['typeid']); $starttime = trim($_POST['starttime']); $endtime = trim($_POST['endtime']); $address = trim($_POST['address']); $coordinate = trim($_POST['coordinate']); //坐标 $content = tsClean($_POST['content']); if ($title == '' || $content == '') { tsNotice('标题和内容不能为空'); } $eventid = $new['event']->create('event', array('userid' => $userid, 'title' => $title, 'typeid' => $typeid, 'starttime' => $starttime, 'endtime' => $endtime, 'address' => $address, 'coordinate' => $coordinate, 'content' => $content, 'isaudit' => 1, 'addtime' => time())); //上传 $arrUpload = tsUpload($_FILES['photo'], $eventid, 'event', array('jpg', 'gif', 'png')); if ($arrUpload) { $new['event']->update('event', array('eventid' => $eventid), array('path' => $arrUpload['path'], 'photo' => $arrUpload['url'])); } header("Location: " . tsUrl('event', 'show', array('id' => $eventid))); break; //地图 //地图 case "map": $dd = isset($_GET['dd']) ? $_GET['dd'] : '中国北京'; include template('add_map'); break; }
$albumid = intval($_GET['albumid']); $strAlbum = $new['photo']->find('photo_album', array('albumid' => $albumid)); $strAlbum['albumname'] = stripslashes($strAlbum['albumname']); $strAlbum['albumdesc'] = stripslashes($strAlbum['albumdesc']); if ($userid != $strAlbum['userid']) { tsNotice('非法操作!'); } $addtime = time(); $title = '上传照片'; include template("upload"); break; case "do": $addtime = intval($_POST['addtime']); $albumid = intval($_POST['albumid']); $verifyToken = md5('unique_salt' . $addtime); $strAlbum = $new['photo']->find('photo_album', array('albumid' => $albumid)); if ($albumid == 0 || $addtime == 0 || $_POST['tokens'] != $verifyToken || $strAlbum == '') { echo 00; exit; } $photoid = $new['photo']->create('photo', array('albumid' => $strAlbum['albumid'], 'userid' => $strAlbum['userid'], 'locationid' => aac('user')->getLocationId($strAlbum['userid']), 'addtime' => date('Y-m-d H:i:s', $addtime))); //上传 $arrUpload = tsUpload($_FILES['Filedata'], $photoid, 'photo', array('jpg', 'gif', 'png')); if ($arrUpload) { $new['photo']->update('photo', array('photoid' => $photoid), array('photoname' => $arrUpload['name'], 'phototype' => $arrUpload['type'], 'path' => $arrUpload['path'], 'photourl' => $arrUpload['url'], 'photosize' => $arrUpload['size'])); //对积分进行出来 aac('user')->doScore($TS_URL['app'], $TS_URL['ac'], $TS_URL['ts'], $strAlbum['userid']); } echo $photoid; break; }
<?php defined('IN_TS') or die('Access Denied.'); //用户是否登录 $userid = aac('user')->isLogin(); switch ($ts) { //上传小组头像 case "photo": $groupid = intval($_POST['groupid']); if ($new['group']->isGroupCreater($groupid, $userid) == false) { tsNotice("非法操作!"); } //上传 $arrUpload = tsUpload($_FILES['picfile'], $groupid, 'group', array('jpg', 'gif', 'png')); if ($arrUpload) { $new['group']->update('group', array('groupid' => $groupid), array('path' => $arrUpload['path'], 'photo' => $arrUpload['url'])); tsDimg($arrUpload['url'], 'group', '48', '48', $arrUpload['path']); tsDimg($arrUpload['url'], 'group', '16', '16', $arrUpload['path']); tsDimg($arrUpload['url'], 'group', '32', '32', $arrUpload['path']); tsDimg($arrUpload['url'], 'group', '24', '24', $arrUpload['path']); tsDimg($arrUpload['url'], 'group', '120', '120', $arrUpload['path']); tsNotice("小组图标修改成功!"); } else { tsNotice("上传出问题啦!"); } break; //编辑小组基本信息 //编辑小组基本信息 case "edit_base": if ($_POST['token'] != $_SESSION['token']) { tsNotice('非法操作!');
$strAlbum['title'] = tsTitle($strAlbum['title']); $strAlbum['content'] = tsDecode($strAlbum['content']); if ($strAlbum['userid'] == $userid || $TS_USER['isadmin'] == 1) { $title = '上传资料'; include template('upload'); } else { tsNotice('非法操作!'); } break; case "do": $albumid = intval($_POST['albumid']); $verifyToken = md5('unique_salt' . $addtime); $strAlbum = $new['attach']->find('attach_album', array('albumid' => $albumid)); if ($albumid == 0 || $_POST['tokens'] != $verifyToken || $strAlbum == '') { echo 00; exit; } $attachid = $new['attach']->create('attach', array('albumid' => $strAlbum['albumid'], 'userid' => $strAlbum['userid'], 'addtime' => date('Y-m-d H:i:s'))); //上传 $arrUpload = tsUpload($_FILES['Filedata'], $attachid, 'attach', array('xls', 'xlsx', 'pptx', 'docx', 'pdf', 'jpg', 'gif', 'png', 'rar', 'zip', 'doc', 'ppt', 'txt')); if ($arrUpload) { $new['attach']->update('attach', array('attachid' => $attachid), array('attachname' => $arrUpload['name'], 'attachtype' => $arrUpload['type'], 'attachurl' => $arrUpload['url'], 'attachsize' => $arrUpload['size'])); //统计 $count_attach = $new['attach']->findCount('attach', array('albumid' => $strAlbum['albumid'])); $new['attach']->update('attach_album', array('albumid' => $strAlbum['albumid']), array('count_attach' => $count_attach)); //对积分进行处理 aac('user')->doScore($TS_URL['app'], $TS_URL['ac'], $TS_URL['ts'], $strAlbum['userid']); } echo $attachid; break; }
aac('system')->antiWord($groupname); aac('system')->antiWord($groupdesc); } //过滤内容结束 //配置文件是否需要审核 $isaudit = intval($TS_APP['isaudit']); if ($TS_USER['isadmin'] == 1) { $isaudit = 0; } $isGroup = $new['group']->findCount('group', array('groupname' => $groupname)); if ($isGroup > 0) { tsNotice("小组名称已经存在,请更换其他小组名称!"); } $groupid = $new['group']->create('group', array('userid' => $userid, 'groupname' => $groupname, 'groupdesc' => $groupdesc, 'isaudit' => $isaudit, 'addtime' => time())); //上传 $arrUpload = tsUpload($_FILES['photo'], $groupid, 'group', array('jpg', 'gif', 'png', 'jpeg')); if ($arrUpload) { $new['group']->update('group', array('groupid' => $groupid), array('path' => $arrUpload['path'], 'photo' => $arrUpload['url'])); } //绑定成员 $new['group']->create('group_user', array('userid' => $userid, 'groupid' => $groupid, 'addtime' => time())); //更新 $count_group = $new['group']->findCount('group_user', array('userid' => $userid)); $new['group']->update('user_info', array('userid' => $userid), array('count_group' => $count_group)); //更新小组人数 $new['group']->update('group', array('groupid' => $groupid), array('count_user' => 1)); //更新分类统计 $cateid = intval($_POST['cateid']); if ($cateid > 0) { $count_group = $new['group']->findCount('group', array('cateid' => $cateid)); $new['group']->update('group_cate', array('cateid' => $cateid), array('count_group' => $count_group));
} break; case "edit": $goodsid = intval($_GET['goodsid']); $arrCate = $new['redeem']->findAll('redeem_cate'); $strGoods = $new['redeem']->find('redeem_goods', array('goodsid' => $goodsid)); include template('admin/goods_edit'); break; case "editdo": $goodsid = intval($_POST['goodsid']); $cateid = intval($_POST['cateid']); $title = trim($_POST['title']); $content = tsClean($_POST['content']); $nums = intval($_POST['nums']); $scores = intval($_POST['scores']); $return = intval($_POST['return']); $new['redeem']->update('redeem_goods', array('goodsid' => $goodsid), array('cateid' => $cateid, 'title' => $title, 'content' => $content, 'nums' => $nums, 'scores' => $scores, '`return`' => $return)); $arrUpload = tsUpload($_FILES['photo'], $goodsid, 'redeem', array('jpg', 'gif', 'png', 'jpeg')); if ($arrUpload) { $new['redeem']->update('redeem_goods', array('goodsid' => $goodsid), array('path' => $arrUpload['path'], 'photo' => $arrUpload['url'])); } header('Location: ' . SITE_URL . 'index.php?app=redeem&ac=admin&mg=goods&ts=list'); break; case "delete": $goodsid = intval($_GET['goodsid']); $strGoods = $new['redeem']->find('redeem_goods', array('goodsid' => $goodsid)); unlink('uploadfile/redeem/' . $strGoods['photo']); $new['redeem']->delete('redeem_goods', array('goodsid' => $goodsid)); qiMsg('删除成功!'); break; }
if ($arrUpload) { $new[$app]->update('slide', array('slideid' => $slideid), array('path' => $arrUpload['path'], 'photo' => $arrUpload['url'])); } header('Location: ' . SITE_URL . 'index.php?app=home&ac=plugin&plugin=slide&in=edit&ts=set'); break; case "edit": $slideid = intval($_GET['slideid']); $strSlide = $new[$app]->find('slide', array('slideid' => $slideid)); include 'edit_edit.html'; break; case "editdo": $slideid = intval($_POST['slideid']); $title = trim($_POST['title']); $url = trim($_POST['url']); $new[$app]->update('slide', array('slideid' => $slideid), array('title' => $title, 'url' => $url)); //上传 $arrUpload = tsUpload($_FILES['photo'], $slideid, 'slide', array('jpg', 'gif', 'png', 'jpeg')); if ($arrUpload) { $new[$app]->update('slide', array('slideid' => $slideid), array('path' => $arrUpload['path'], 'photo' => $arrUpload['url'])); tsDimg($arrUpload['url'], 'slide', '630', '340', $arrUpload['path']); } header('Location: ' . SITE_URL . 'index.php?app=home&ac=plugin&plugin=slide&in=edit&ts=set'); break; case "delete": $slideid = intval($_GET['slideid']); $strSlide = $new[$app]->find('slide', array('slideid' => $slideid)); unlink('uploadfile/slide/' . $strSlide['photo']); $new[$app]->delete('slide', array('slideid' => $slideid)); header('Location: ' . SITE_URL . 'index.php?app=home&ac=plugin&plugin=slide&in=edit&ts=set'); break; }
public function photo() { $userid = intval($GLOBALS['TS_USER']['userid']); if ($userid == 0) { echo 0; exit; //请登录 } if ($_POST['token'] != $_SESSION['token']) { echo 1; exit; //非法操作 } $content = tsClean($_POST['content']); if ($GLOBALS['TS_USER']['isadmin'] == 0) { //过滤内容开始 aac('system')->antiWord($content); //过滤内容结束 } $weiboid = $this->create('weibo', array('userid' => $userid, 'content' => $content, 'isaudit' => 0, 'addtime' => date('Y-m-d H:i:s'), 'uptime' => date('Y-m-d H:i:s'))); // 上传图片开始 $arrUpload = tsUpload($_FILES['filedata'], $weiboid, 'weibo', array('jpg', 'gif', 'png', 'jpeg')); if ($arrUpload) { $this->update('weibo', array('weiboid' => $weiboid), array('path' => $arrUpload['path'], 'photo' => $arrUpload['url'])); echo 3; exit; } else { echo 2; exit; } }
$new['location']->update('location', array('locationid' => $locationid), array('path' => $arrUpload['path'], 'photo' => $arrUpload['url'])); } header('Location: ' . SITE_URL . 'index.php?app=location&ac=admin&mg=location&ts=list'); break; case "edit": $locationid = intval($_GET['locationid']); $strLocation = $new['location']->find('location', array('locationid' => $locationid)); include template('admin/location_edit'); break; case "editdo": $locationid = intval($_POST['locationid']); $title = t($_POST['title']); $content = trim($_POST['content']); $orderid = intval($_POST['orderid']); $new['location']->update('location', array('locationid' => $locationid), array('title' => $title, 'content' => $content, 'orderid' => $orderid)); $arrUpload = tsUpload($_FILES['photo'], $locationid, 'location', array('jpg', 'gif', 'png', 'jpeg')); if ($arrUpload) { $new['location']->update('location', array('locationid' => $locationid), array('path' => $arrUpload['path'], 'photo' => $arrUpload['url'])); } header('Location: ' . SITE_URL . 'index.php?app=location&ac=admin&mg=location&ts=list'); break; case "delete": $locationid = intval($_GET['locationid']); $strLocation = $new['location']->find('location', array('locationid' => $locationid)); unlink('uploadfile/location/' . $strLocation['photo']); $new['location']->delete('location', array('locationid' => $locationid)); $new['location']->update('article', array('locationid' => $locationid), array('locationid' => 0)); $new['location']->update('attach', array('locationid' => $locationid), array('locationid' => 0)); $new['location']->update('group_topic', array('locationid' => $locationid), array('locationid' => 0)); $new['location']->update('photo', array('locationid' => $locationid), array('locationid' => 0)); $new['location']->update('user_info', array('locationid' => $locationid), array('locationid' => 0));
tsNotice('非法操作!'); } $cateid = intval($_POST['cateid']); $title = trim($_POST['title']); $content = tsClean($_POST['content']); if ($TS_USER['isadmin'] == 0) { // 过滤内容开始 aac('system')->antiWord($title); aac('system')->antiWord($content); // 过滤内容结束 } if ($title == '' || $content == '') { qiMsg("标题和内容都不能为空!"); } $new['article']->update('article', array('articleid' => $articleid), array('cateid' => $cateid, 'title' => $title, 'content' => $content)); // 处理标签 $tag = trim($_POST['tag']); if ($tag) { aac('tag')->delIndextag('article', 'articleid', $articleid); aac('tag')->addTag('article', 'articleid', $articleid, $tag); } // 上传帖子图片开始 $arrUpload = tsUpload($_FILES['photo'], $articleid, 'article', array('jpg', 'gif', 'png', 'jpeg')); if ($arrUpload) { $new['article']->update('article', array('articleid' => $articleid), array('path' => $arrUpload['path'], 'photo' => $arrUpload['url'])); tsDimg($arrUpload['url'], 'article', '180', '140', $arrUpload['path']); } // 上传帖子图片结束 header("Location: " . tsUrl('article', 'show', array('id' => $articleid))); break; }