public function addAction()
 {
     $status = $this->getInput('startup_status');
     //
     $config = new PwConfigSet('native');
     if (count($_FILES)) {
         Wind::import('SRV:upload.action.PwStartUpUpload');
         Wind::import('LIB:upload.PwUpload');
         $bhv = new PwStartUpUpload();
         $bhv->filename = 'startup';
         //
         $upload = new PwUpload($bhv);
         if ($upload->check() === true) {
             $result = $upload->execute();
         }
         if ($result !== true) {
             $this->showError($result->getError());
         }
         if (!($data = $bhv->getAttachInfo())) {
             $this->showError('upload.fail');
         }
         //
         $filepath = $upload->getStore()->getAbsolutePath($data['filename'], $data['path']);
         $filecontent = file_get_contents($filepath);
         //
         $config->set('startup.imgmd5', md5($filecontent));
         $config->set('startup.img', $data['path'] . $data['filename']);
     }
     $config->set('startup.status', $status)->flush();
     $this->showMessage('ADMIN:success');
 }
 /**
  * 淘宝推广图片 
  * 
  * @access public
  * @return void
  */
 public function dotaoAction()
 {
     if (!($user = $this->_getUser())) {
         $this->showError('login.not');
     }
     $fid = $this->getInput('fid', 'post');
     //
     $this->_accpetUploadForH5();
     //
     Wind::import('SRV:upload.action.PwTaoUpload');
     Wind::import('LIB:upload.PwUpload');
     $bhv = new PwTaoUpload();
     $bhv->filename = date('YmdHis');
     //
     $upload = new PwUpload($bhv);
     if (($result = $upload->check()) === true) {
         $result = $upload->execute();
     }
     if ($result !== true) {
         $this->showError($result->getError());
     }
     if (!($data = $bhv->getAttachInfo())) {
         $this->showError('upload.fail');
     }
     $data['path'] = Pw::getPath($data['path'] . $data['filename']);
     //
     $this->setOutput($data, 'data');
     $this->showMessage('upload.success');
 }
 /**
  * 发存修改一个发现数据 
  * 
  * @access public
  * @return void
  */
 public function doAddAction()
 {
     list($fid, $title, $href, $des, $vieworder) = $this->getInput(array('fid', 'title', 'href', 'des', 'vieworder'));
     $title = trim($title);
     $href = trim($href);
     $des = trim($des);
     $vieworder = (int) $vieworder;
     if (empty($title)) {
         $this->showError("NATIVE:fresh.title.empty");
     }
     if (empty($href)) {
         $this->showError("NATIVE:fresh.link.empty");
     }
     if (Pw::strlen($title) > 5) {
         $this->showError("名称不能超过5个字符");
     }
     if (Pw::strlen($des) > 9) {
         $this->showError("备注不能超过9个字符");
     }
     if ($fid) {
         $fname = $fid;
     } else {
         $maxId = $this->_getDao()->getMaxId();
         $fname = count($maxId) ? $maxId['fresh_id'] + 1 : 1;
     }
     if (!$fid && !$_FILES) {
         $this->showError('NATIVE:upload.empty');
     }
     if ($_FILES) {
         Wind::import('SRV:upload.action.PwFreshUpload');
         Wind::import('LIB:upload.PwUpload');
         $bhv = new PwFreshUpload();
         $bhv->filename = $fname;
         $upload = new PwUpload($bhv);
         if ($upload->check() === true) {
             $result = $upload->execute();
         }
         if ($result !== true) {
             $this->showError($result->getError());
         }
         if (!($data = $bhv->getAttachInfo())) {
             $this->showError('upload.fail');
         }
         $img = $data['path'] . $data['filename'];
     }
     $data = array('title' => $title, 'href' => $href, 'des' => $des, 'vieworder' => $order);
     if ($img && $_FILES) {
         $data['img'] = $img;
     }
     if ($fid) {
         $this->_getDao()->updateFresh($fid, $data);
     } else {
         $this->_getDao()->addFresh($data);
     }
     $this->showMessage('success');
 }
 /**
  *
  * @access public
  * @return
  * @example
  *
  */
 public function dosetAction()
 {
     /*
     $vd = function() {
         foreach(func_get_args() as $arg) {
             error_log(var_export($arg, true));
         }
     };
     */
     $config = new PwConfigSet('notifier');
     /*
      * 如果form的class是J_ajaxForm,可以只按照count($_FILES)来判断;
      * 如果不是,需要判断具体的tmp_name是否为空来判断是否选择了文件。
      *
      */
     if (count($_FILES) && !empty($_FILES['avatar']['tmp_name'])) {
         Wind::import('SRV:upload.action.PwStartUpUpload');
         Wind::import('LIB:upload.PwUpload');
         $bhv = new PwStartUpUpload();
         $bhv->filename = 'avatar';
         $upload = new PwUpload($bhv);
         if ($upload->check() === true) {
             $result = $upload->execute();
         }
         if ($result !== true) {
             $this->showError($result->getError());
         }
         if (!($data = $bhv->getAttachInfo())) {
             $this->showError('upload.fail');
         }
         // 添加进设置项
         $config->set('avatar', $data['path'] . $data['filename']);
     }
     $nickname = $this->getInput('nickname');
     if (empty($nickname)) {
         $nickname = PwLaiWangSerivce::$defaultNotifier['nickname'];
     }
     $usertype = intval($this->getInput('usertype'));
     if ($usertype != PwLaiWangSerivce::USERTYPE_NAME && $usertype != PwLaiWangSerivce::USERTYPE_ID) {
         $usertype = PwLaiWangSerivce::USERTYPE_NAME;
     }
     $user = $this->getInput('user');
     if ($usertype == PwLaiWangSerivce::USERTYPE_NAME) {
         $userinfo = Wekit::load('user.PwUser')->getUserByName($user, PwUser::FETCH_MAIN);
     } else {
         $userinfo = Wekit::load('user.PwUser')->getUserByUid($user, PwUser::FETCH_MAIN);
     }
     if (empty($userinfo)) {
         $this->showError('NATIVE:user.notfound');
     }
     $config->set('nickname', $nickname)->set('usertype', $usertype)->set('username', $userinfo['username'])->set('userid', $userinfo['uid'])->flush();
     $this->showMessage('ADMIN:success', 'native/notifier/run/', true);
 }
 public function doAddAction()
 {
     list($bid, $title, $clickType, $href, $vieworder, $img) = $this->getInput(array('bid', 'title', 'clickType', 'href', 'vieworder', 'img'));
     $title = trim($title);
     $href = trim($href);
     $vieworder = (int) $vieworder;
     if (count($this->_getDao()->getBanner(PwBanner::BANNER_TYPE_NATIVE_INDEX)) >= 4 && !$bid) {
         $this->showError("NATIVE:banner.num.out");
     }
     if (empty($title)) {
         $this->showError("NATIVE:banner.title.empty");
     }
     if (empty($clickType)) {
         $this->showError("NATIVE:banner.clickType.empty");
     }
     if (empty($href)) {
         $this->showError("NATIVE:banner.link.empty");
     }
     if ($bid) {
         $fname = $bid;
     } else {
         $maxId = $this->_getDao()->getMaxId();
         $fname = count($maxId) ? $maxId['banner_id'] + 1 : 1;
     }
     if (count($_FILES)) {
         Wind::import('SRV:upload.action.PwBannerUpload');
         Wind::import('LIB:upload.PwUpload');
         $bhv = new PwBannerUpload();
         $bhv->filename = $fname;
         $upload = new PwUpload($bhv);
         if ($upload->check() === true) {
             $result = $upload->execute();
         }
         if ($result !== true) {
             $this->showError($result->getError());
         }
         if (!($data = $bhv->getAttachInfo())) {
             $this->showError('upload.fail');
         }
         $img = $data['path'] . $data['filename'];
     } elseif (empty($bid)) {
         $this->showError('upload.empty');
     }
     $data = array('banner_type' => PwBanner::BANNER_TYPE_NATIVE_INDEX, 'type' => $clickType, 'title' => $title, 'href' => $href, 'img' => $img, 'vieworder' => $order);
     if ($bid) {
         $this->_getDao()->updateBanner($bid, $data);
     } else {
         $this->_getDao()->addBanner($data);
     }
     $this->showMessage('success');
 }
 function add($attach)
 {
     $upload = array('attname' => 'attachment', 'id' => intval($attach['aid']), 'name' => $attach['name'], 'size' => $attach['size'], 'type' => 'zip', 'ifthumb' => 0, 'fileuploadurl' => '');
     $upload['ext'] = strtolower(substr(strrchr($attach['attachurl'], '.'), 1));
     if (empty($upload['ext']) || !isset($this->bhv->ftype[$upload['ext']])) {
         return false;
     }
     if ($upload['size'] < 1 || $upload['size'] > $this->bhv->ftype[$upload['ext']] * 1024) {
         return false;
     }
     $dir = dirname($attach['attachurl']);
     $dir && ($dir .= '/');
     $srcfile = PwUpload::savePath($this->bhv->ifftp, basename($attach['attachurl']), $dir);
     if (!file_exists($srcfile)) {
         if ($this->bhv->ifftp) {
             $ftp =& PwUpload::getFtpObj();
             PwUpload::createFolder(dirname($srcfile));
             if (!$ftp->get($srcfile, $attach['attachurl'])) {
                 return false;
             }
         } else {
             return false;
         }
     }
     list($filename, $savedir) = $this->bhv->getFilePath($upload);
     $source = PwUpload::savePath($this->bhv->ifftp, $filename, $savedir);
     PwUpload::createFolder(dirname($source));
     if (!copy($srcfile, $source)) {
         return false;
     }
     $upload['fileuploadurl'] = $savedir . $filename;
     PwUpload::operateAttach($source, $filename, $savedir, $upload, $this->bhv);
     $this->upload[] = $upload;
     return true;
 }
Beispiel #7
0
 /**
  * 上传csv文件到服务器端
  *
  */
 function _uploadCsv()
 {
     L::loadClass('csvupload', 'upload', false);
     $csvupload = new CsvUpload($this->_uid);
     PwUpload::upload($csvupload);
     $this->_filename = $csvupload->pathname;
 }
 /**
  * 暂时不用
  */
 public function replaceAction()
 {
     $aid = $this->getInput('aid');
     Wind::import('SRV:upload.action.PwAttReplaceUpload');
     Wind::import('LIB:upload.PwUpload');
     $bhv = new PwAttReplaceUpload($this->loginUser, $aid);
     $upload = new PwUpload($bhv);
     if (($result = $upload->check()) === true) {
         $result = $upload->execute();
     }
     if ($result !== true) {
         $this->showError($result->getError());
     }
     $this->setOutput($bhv->getAttachInfo(), 'data');
     $this->showMessage('upload.success');
 }
 private function _uploadFile()
 {
     Wind::import('SRV:upload.action.PwDesignImageUpload');
     Wind::import('SRV:upload.PwUpload');
     $bhv = new PwDesignImageUpload();
     $upload = new PwUpload($bhv);
     if (($result = $upload->check()) === true) {
         $result = $upload->execute();
     }
     if ($result !== true) {
         return $result;
     }
     $image = $bhv->getAttachInfo();
     if (!$image['filename']) {
         return '';
     }
     return Pw::getPath($image['path'] . $image['filename']);
 }
 public function updateIcon($uid)
 {
     $userBo = Wekit::getLoginUser();
     if ($userBo->uid != $uid) {
         return $this->buildResponse(USER_NOT_LOGIN, "用户未登录");
     }
     Wind::import('SRV:upload.action.PwAvatarUpload');
     Wind::import('LIB:upload.PwUpload');
     $bhv = new PwAvatarUpload($userBo);
     $upload = new PwUpload($bhv);
     if (($result = $upload->check()) === true) {
         $result = $upload->execute();
     }
     if ($result !== true) {
         return $this->buildResponse(USER_UPDATE_ERROR, "更新头像");
     } else {
         return $this->buildResponse(0, '更新成功');
     }
 }
 public function makeThumb(PwImage $image, $thumbInfo, $store)
 {
     $quality = Wekit::C('attachment', 'thumb.quality');
     foreach ($thumbInfo as $key => $value) {
         $thumburl = $store->getAbsolutePath($value[0], $value[1]);
         PwUpload::createFolder(dirname($thumburl));
         $result = $image->makeThumb($thumburl, $value[2], $value[3], $quality, $value[4], $value[5]);
         if ($result === true && $image->filename != $thumburl) {
             $this->ifthumb |= 1 << $key;
             $this->_thumb[] = array($thumburl, $value[1] . $value[0]);
         }
     }
 }
Beispiel #12
0
 /**
  * @see PwUploadAction.check
  */
 public function check()
 {
     if (!$this->user->isExists()) {
         return new PwError('login.not');
     }
     if (!$this->forum->isForum()) {
         return new PwError('FORUM_IS_NOT_EXISTS');
     }
     if (($result = $this->forum->allowUpload($this->user)) !== true) {
         return new PwError('BBS:forum.permissions.upload.allow', array('{grouptitle}' => $this->user->getGroupInfo('name')));
     }
     if (!$this->forum->foruminfo['allow_upload'] && !$this->user->getPermission('allow_upload')) {
         return new PwError('permission.upload.allow', array('{grouptitle}' => $this->user->getGroupInfo('name')));
     }
     if ($uploadPerday = $this->user->getPermission('uploads_perday')) {
         $count = PwUpload::countUploadedFile() + count($this->flashatt);
         $todayupload = $this->user->info['lastpost'] < Pw::getTdtime() ? 0 : $this->user->info['todayupload'];
         if ($count > 0 && $count + $todayupload > $uploadPerday) {
             return new PwError('permission.upload.nums.perday', array('{nums}' => $uploadPerday));
         }
     }
     return true;
 }
Beispiel #13
0
     } else {
         $db->update("INSERT INTO pw_cnalbum SET " . pwSqlSingle(array('aname' => getLangInfo('app', 'defaultalbum'), 'atype' => 0, 'ownerid' => $winduid, 'owner' => $windid, 'lasttime' => $timestamp, 'crtime' => $timestamp)));
         $aid = $db->insert_id();
     }
 }
 !$aid && Showmsg('colony_albumclass');
 $rt = $db->get_one("SELECT aname,photonum,ownerid,private,lastphoto FROM pw_cnalbum WHERE atype='0' AND aid=" . pwEscape($aid));
 if (empty($rt)) {
     Showmsg('undefined_action');
 } elseif ($winduid != $rt['ownerid']) {
     Showmsg('colony_phototype');
 }
 $o_maxphotonum && $rt['photonum'] >= $o_maxphotonum && Showmsg('colony_photofull');
 require_once R_P . 'lib/upload/photoupload.class.php';
 $img = new PhotoUpload($aid);
 PwUpload::upload($img);
 pwFtpClose($ftp);
 if (!($photos = $img->getAttachs())) {
     refreshto("{$basename}a=upload", 'colony_uploadnull');
 }
 $photoNum = count($photos);
 $pid = $img->getNewID();
 $lastpid = getLastPid($aid, 4);
 array_unshift($lastpid, $pid);
 if (!$rt['private']) {
     $feedText = "[url={$db_bbsurl}/{$basename}space=1&a=album&aid={$aid}&u={$winduid}]{$rt[aname]}[/url]\n";
     foreach ($photos as $value) {
         $feedText .= "[url={$db_bbsurl}/{#APPS_BASEURL#}q=photos&space=1&a=view&pid={$pid}&u={$winduid}][img]" . getphotourl($value['path'], $value['ifthumb']) . "[/img][/url]&nbsp;";
     }
     pwAddFeed($winduid, 'photo', $pid, array('num' => $photoNum, 'text' => $feedText));
     //会员资讯缓存
Beispiel #14
0
 }
 if ($config['width']) {
     $config['width'] = intval($config['width']) . ($config['width'][strlen($config['width']) - 1] == '%' ? '%' : '');
 }
 if ($config['height']) {
     $config['height'] = intval($config['height']) . ($config['height'][strlen($config['height']) - 1] == '%' ? '%' : '');
 }
 //广告图片上传
 if ($config['type'] == 'img') {
     //图片上传
     $newConfigUrl = $newConfigLink = array();
     L::loadClass('advupload', 'upload', false);
     foreach ($config['imgupload'] as $key => $value) {
         if ($value != 0) {
             $img = new AdvUpload($key);
             $returnImg = PwUpload::upload($img);
             if (!is_array($returnImg) || count($returnImg) == 0) {
                 continue;
             }
             list($newConfigUrl[]) = geturl($returnImg[0]['fileuploadurl'], 'lf');
             $newConfigLink[] = $config['link'][$key];
         } else {
             $newConfigUrl[] = $config['url'][$key];
             $newConfigLink[] = $config['link'][$key];
         }
     }
     unset($config['imgupload']);
     $config['link'] = $newConfigLink;
     $config['url'] = $newConfigUrl;
 }
 foreach ($config as $key => $value) {
Beispiel #15
0
    /*
    if ($privacy && is_array($privacy)) {
    	$pwSQL = array();
    	foreach ($privacy as $key => $value) {
    		if (in_array($key, $spaceModel)) {
    			$pwSQL[] = array(
    				'uid'	=> $winduid,
    				'type'	=> 'space',
    				'key'	=> $key,
    				'value'	=> $value
    			);
    		}
    	}
    	$pwSQL && $db->update("replace INTO pw_privacy (uid, ptype, pkey, value) values " . S::sqlMulti($pwSQL));
    }
    if ($domain != $space['domain'] && $db->get_value("SELECT COUNT(*) AS sum FROM pw_space WHERE domain=" . S::sqlEscape($domain))) {
    	Showmsg('该域名已被使用!');
    }
    */
    $pwSQL = array('name' => $name, 'descript' => $descript, 'domain' => $domain, 'spacestyle' => $spacestyle, 'spacetype' => $spacetype, 'skin' => $spaceskin, 'modelset' => serialize($modelset));
    $layout && ($pwSQL['layout'] = serialize($layout));
    set_time_limit(0);
    require_once R_P . 'u/lib/spacebannerupload.class.php';
    $upload = new spaceBannerUpload($winduid);
    PwUpload::upload($upload);
    if ($img = $upload->getImgUrl()) {
        $pwSQL['banner'] = $img;
    }
    $newSpace->updateInfo($pwSQL);
    refreshto('u.php?a=set', 'operate_success');
}
Beispiel #16
0
 function sendPost($tid, $uid, $title, $content)
 {
     global $winddb, $winduid, $windid, $groupid, $fid, $timestamp, $pwforum, $pwpost, $_G, $db_uploadfiletype, $uploadcredit, $uploadmoney, $manager, $isBM, $_time;
     $timestamp = time();
     $_time = array('hours' => get_date($timestamp, 'G'), 'day' => get_date($timestamp, 'j'), 'week' => get_date($timestamp, 'w'));
     list($uid, $tid, $title, $content) = array(intval($uid), intval($tid), trim($title), trim($content));
     if ($uid < 1 || $tid < 1 || !$content) {
         return $this->buildResponse(THREAD_INVALID_PARAMS);
     }
     ACloud_Sys_Core_Common::setGlobal('customized_current_uid', $uid);
     $user = $this->getCurrentUser();
     if (!$user->isLogin()) {
         return $this->buildResponse(USER_NOT_LOGIN);
     }
     if ($user->groupid == 6 || getstatus($user->info['userstatus'], PW_USERSTATUS_BANUSER)) {
         return $this->buildResponse(THREAD_USER_NOT_RIGHT);
     }
     $user->initRight();
     $winduid = $user->uid;
     $groupid = $user->groupid;
     $windid = $user->username;
     $winddb = $user->info;
     $_G = $user->_G;
     if ($_G['postlimit'] && $winddb['todaypost'] >= $_G['postlimit']) {
         return $this->buildResponse(POST_GP_LIMIT);
     }
     $tpcarray = $GLOBALS['db']->get_one("SELECT t.tid,t.fid,t.locked,t.ifcheck,t.author,t.authorid,t.postdate,t.lastpost,t.ifmail,t.special,t.subject,t.type,t.ifshield,t.anonymous,t.ptable,t.replies,t.tpcstatus FROM pw_threads t WHERE t.tid=" . pwEscape($tid));
     L::loadClass('forum', 'forum', false);
     $pwforum = new PwForum($tpcarray['fid']);
     if (!$pwforum->isForum()) {
         return $this->buildResponse(THREAD_FORUM_NOT_EXIST);
     }
     $fid = $tpcarray['fid'];
     $isBM = $pwforum->isBM($windid);
     $isGM = S::inArray($windid, $manager);
     if (!$isGM && $tpcarray['locked'] % 3 != 0 && !pwRights($isBM, 'replylock')) {
         return $this->buildResponse(THREAD_LOCKED);
     }
     L::loadClass('post', 'forum', false);
     require_once ACLOUD_VERSION_PATH . '/customized/ver.customized.bbscode.php';
     $pwpost = new PwPost($pwforum);
     $pwpost->errMode = true;
     $pwpost->forumcheck();
     $pwpost->postcheck();
     L::loadClass('replypost', 'forum', false);
     $replypost = new replyPost($pwpost);
     $replypost->setTpc($tpcarray);
     $replypost->check();
     $pw_posts = GetPtable($replypost->tpcArr['ptable']);
     $postdata = new replyPostData($pwpost);
     $postdata->setTitle($title);
     $postdata->setContent($content);
     $postdata->conentCheck();
     if ($pwpost->errMsg && ($msg = reset($pwpost->errMsg))) {
         return $this->buildResponse(THREAD_SYSTEM_ERROR, $msg);
     }
     require_once ACLOUD_VERSION_PATH . '/customized/ver.customized.attupload.php';
     if (PwUpload::getUploadNum()) {
         $_G['uploadtype'] && ($db_uploadfiletype = $_G['uploadtype']);
         $db_uploadfiletype = !empty($db_uploadfiletype) ? is_array($db_uploadfiletype) ? $db_uploadfiletype : unserialize($db_uploadfiletype) : array();
         $postdata->att = new AttUpload($user->uid);
         $return = $postdata->att->check();
         if ($return) {
             $msginfo = getLangInfo('msg', $return);
             return $this->errMessage(THREAD_USER_NOT_RIGHT, $msginfo);
         }
         list($windVersion) = explode(',', WIND_VERSION);
         if ($windVersion && $windVersion < '8.5') {
             $postdata->att->transfer();
             PwUpload::upload($postdata->att);
         }
     }
     $replypost->execute($postdata);
     $pid = $replypost->getNewId();
     return $this->buildResponse(0, array('pid' => $pid));
 }
 /**
  * 设置附件
  * @param array $oldatt_desc
  * @param array $keep
  */
 function setAttach($flashatt, $oldatt_desc = array())
 {
     global $db_allowupload, $_G;
     $attachs = $this->attach ? $this->attach : array();
     $attachs = $this->_cookOldAttachs($attachs, $oldatt_desc);
     C::loadClass('articleupload', 'upload', false);
     $uploaddb = array();
     if ($db_allowupload && $_G['allowupload'] && (PwUpload::getUploadNum() || $flashatt)) {
         $articleUpload = new ArticleUpload();
         $articleUpload->setFlashAtt($flashatt, intval($_POST['savetoalbum']), intval($_POST['albumid']));
         PwUpload::upload($articleUpload);
         $uploaddb = $articleUpload->getAttachs();
     }
     $this->attach = (array) $attachs + (array) $uploaddb;
 }
 function insertData($tid, $fid)
 {
     /*操作数据库*/
     $this->data['tid'] = $tid;
     $this->data['fid'] = $fid;
     $topicdb = unserialize($this->data['topic']);
     unset($this->data['topic']);
     foreach ($topicdb as $key => $value) {
         $this->data['field' . $key] = $value;
     }
     $tablename = GetTopcitable($this->modelid);
     $this->db->pw_update("SELECT tid FROM {$tablename} WHERE tid=" . S::sqlEscape($tid), "UPDATE {$tablename} SET " . S::sqlSingle($this->data) . "WHERE tid=" . S::sqlEscape($tid), "INSERT INTO {$tablename} SET " . S::sqlSingle($this->data));
     /*附件上传*/
     require_once R_P . 'require/functions.php';
     L::loadClass('pcupload', 'upload', false);
     $img = new PcUpload($tid, $this->modelid);
     PwUpload::upload($img);
     pwFtpClose($GLOBALS['ftp']);
 }
 private function _uploadImage($key = 'image')
 {
     Wind::import('SRV:upload.action.PwMedalUpload');
     Wind::import('LIB:upload.PwUpload');
     if ($key == 'image') {
         $bhv = new PwMedalUpload('image', 80, 80);
     } else {
         $bhv = new PwMedalUpload('icon', 30, 30);
     }
     $upload = new PwUpload($bhv);
     if (($result = $upload->check()) === true) {
         $result = $upload->execute();
     }
     if ($result !== true) {
         $this->showError($result->getError());
     }
     return $bhv->getAttachInfo();
 }
Beispiel #20
0
 public function defaultAvatar($uid, $type = 'face')
 {
     Wind::import('LIB:upload.PwUpload');
     $_avatar = array('.jpg' => '_big.jpg', '_middle.jpg' => '_middle.jpg', '_small.jpg' => '_small.jpg');
     $defaultBanDir = Wind::getRealDir('RES:') . 'images/face/';
     $store = Wind::getComponent('storage');
     $fileDir = 'avatar/' . Pw::getUserDir($uid) . '/';
     foreach ($_avatar as $des => $org) {
         $toPath = $store->getAbsolutePath($uid . $des, $fileDir);
         $fromPath = $defaultBanDir . $type . $org;
         PwUpload::createFolder(dirname($toPath));
         PwUpload::copyFile($fromPath, $toPath);
         $store->save($toPath, $fileDir . $uid . $des);
     }
     return true;
 }
Beispiel #21
0
 $pwSQL = array('cname' => $cname, 'styleid' => $styleid, 'descrip' => $descrip, 'annouce' => $annouce, 'titlefont' => $titlefont);
 require_once R_P . 'require/functions.php';
 require_once A_P . 'groups/lib/imgupload.class.php';
 if (empty($q_1)) {
     $img = new CnimgUpload($cyid);
     PwUpload::upload($img);
     pwFtpClose($ftp);
     if ($cnimg = $img->getImgUrl()) {
         $pwSQL['cnimg'] = substr(strrchr($cnimg, '/'), 1);
     }
 } else {
     $pwSQL['cnimg'] = '';
 }
 if (empty($q_2)) {
     $banner = new BannerUpload($cyid);
     PwUpload::upload($banner);
     pwFtpClose($ftp);
     if ($cnbanner = $banner->getImgUrl()) {
         $pwSQL['banner'] = substr(strrchr($cnbanner, '/'), 1);
     }
 } else {
     $pwSQL['banner'] = '';
 }
 require_once R_P . 'require/bbscode.php';
 $wordsfb = L::loadClass('FilterUtil', 'filter');
 foreach (array($cname, $annouce, $descrip) as $key => $value) {
     if (($banword = $wordsfb->comprise($value)) !== false) {
         Showmsg('content_wordsfb');
     }
 }
 //* $db->update("UPDATE pw_colonys SET " . S::sqlSingle($pwSQL) . ' WHERE id=' . S::sqlEscape($cyid));
Beispiel #22
0
 private function _uploadImage()
 {
     Wind::import('SRV:upload.action.PwSpaceUpload');
     Wind::import('SRV:upload.PwUpload');
     $bhv = new PwSpaceUpload($this->loginUser->uid);
     $upload = new PwUpload($bhv);
     if (($result = $upload->check()) === true) {
         $result = $upload->execute();
     }
     if ($result !== true) {
         $this->showError($result->getError());
     }
     return $bhv->getAttachInfo();
 }
 public function doimportAction()
 {
     Wind::import('SRV:upload.action.PwWordUpload');
     Wind::import('LIB:upload.PwUpload');
     $bhv = new PwWordUpload();
     $upload = new PwUpload($bhv);
     if (($result = $upload->check()) === true) {
         $result = $upload->execute();
     }
     if ($result !== true) {
         $error = $result->getError();
         if (is_array($error)) {
             list($error, ) = $error;
             if ($error == 'upload.ext.error') {
                 $this->showError('WORD:ext.error');
             }
         }
         $this->showError($result->getError());
     }
     $source = $bhv->getAbsoluteFile();
     if (!WindFile::isFile($source)) {
         $this->showError('operate.fail');
     }
     $content = WindFile::read($source);
     pw::deleteAttach($bhv->dir . $bhv->filename, 0, $bhv->isLocal);
     $content = explode("\n", $content);
     if (!$content) {
         $this->showError('WORD:import.data.empty');
     }
     $wordService = $this->_getWordService();
     $typeMap = $this->_getWordDS()->getTypeMap();
     Wind::import('SRV:word.dm.PwWordDm');
     foreach ($content as $value) {
         list($word, $type, $replace) = $this->_parseTextUseInImport($value, $typeMap);
         if (!$word || !$type || $wordService->isExistWord($word)) {
             continue;
         }
         $dm = new PwWordDm();
         /* @var $dm PwWordDm */
         $dm->setWord($word)->setWordType($type);
         $replace = $this->_getWordDS()->isReplaceWord($type) ? $replace ? $replace : '****' : '';
         $dm->setWordReplace($replace);
         $this->_getWordDS()->add($dm);
     }
     $this->_getWordFilter()->updateCache();
     $this->showMessage('success');
 }
Beispiel #24
0
     require_once R_P . "lib/special/post_{$special}.class.php";
     $postSpecial = new postSpecial($pwpost);
     $postSpecial->modifyData($tid);
 }
 if ($postmodify->hasAtt()) {
     InitGP(array('keep', 'oldatt_special', 'oldatt_needrvrc'), 'P', 2);
     InitGP(array('oldatt_ctype', 'oldatt_desc'), 'P');
     $postmodify->initAttachs($keep, $oldatt_special, $oldatt_needrvrc, $oldatt_ctype, $oldatt_desc);
 }
 require_once R_P . 'lib/upload/attupload.class.php';
 if (PwUpload::getUploadNum() || $flashatt) {
     $postdata->att = new AttUpload($winduid, $flashatt);
     $postdata->att->check();
     $postdata->att->transfer();
     $postdata->att->setReplaceAtt($postmodify->replacedb);
     PwUpload::upload($postdata->att);
 }
 $postmodify->execute($postdata);
 if ($postSpecial) {
     $postSpecial->updateData($tid);
 }
 if ($postTopic) {
     //分类主题
     $postTopic->initData();
     $postTopic->insertData($tid, $fid);
 }
 if ($postCate) {
     //团购活动
     $postCate->initData();
     $postCate->insertData($tid, $fid);
 }
Beispiel #25
0
 private function _uploadFile($key, $moduleid = 0)
 {
     Wind::import('SRV:upload.action.PwDesignDataUpload');
     Wind::import('SRV:upload.PwUpload');
     $bhv = new PwDesignDataUpload($key, $moduleid);
     $upload = new PwUpload($bhv);
     if (($result = $upload->check()) === true) {
         $result = $upload->execute();
     }
     if ($result !== true) {
         $this->showError($result->getError());
     }
     $image = $bhv->getAttachInfo();
     return $image['filename'] ? Pw::getPath($image['path'] . $image['filename']) : "";
 }
Beispiel #26
0
 function insertData($tid, $fid)
 {
     /*操作数据库*/
     global $timestamp;
     $this->data['tid'] = $tid;
     $this->data['fid'] = $fid;
     $pcdb = unserialize($this->data['postcate']);
     unset($this->data['postcate']);
     foreach ($pcdb as $key => $value) {
         $this->data[$key] = $value;
     }
     $pcvaluetable = GetPcatetable($this->pcid);
     $this->db->pw_update("SELECT tid FROM {$pcvaluetable} WHERE tid=" . S::sqlEscape($tid), "UPDATE {$pcvaluetable} SET " . S::sqlSingle($this->data) . "WHERE tid=" . S::sqlEscape($tid), "INSERT INTO {$pcvaluetable} SET " . S::sqlSingle($this->data));
     /*附件上传-淡定*/
     require_once R_P . 'require/functions.php';
     L::loadClass('pcupload', 'upload', false);
     $img = new PcUpload($tid, $this->pcid);
     PwUpload::upload($img);
     pwFtpClose($GLOBALS['ftp']);
 }
 /**
  * 上传头像
  */
 public function doavatarAction()
 {
     $uid = (int) $this->getInput('uid', 'get');
     Wind::import('WSRV:upload.action.WindidAvatarUpload');
     Wind::import('LIB:upload.PwUpload');
     $bhv = new WindidAvatarUpload($uid);
     $upload = new PwUpload($bhv);
     if (($result = $upload->check()) === true) {
         $result = $upload->execute();
     } else {
         $this->output($this->errorCode('upload.content.error'));
     }
     if ($result instanceof PwError) {
         $this->output($this->errorCode($result->getError()));
     } else {
         $this->_getNotifyService()->send('uploadAvatar', array('uid' => $uid), 0);
         //服务端发送通知
         $this->output(1);
     }
 }
Beispiel #28
0
 		'ifcopy'	=> $diary['ifcopy'],
 		'ifconvert'	=> $diary['ifconvert'],
 		'ifwordsfb'	=> $diary['ifwordsfb'],
 		'postdate'	=> $timestamp,
 	));
 	$db->update("INSERT INTO pw_diary SET $pwSQL");****/
 $pwSQL = array('uid' => $winduid, 'dtid' => $dtid, 'username' => $windid, 'privacy' => $privacy, 'subject' => $diary['subject'], 'copyurl' => $diary['copyurl'], 'ifcopy' => $diary['ifcopy'], 'ifconvert' => $diary['ifconvert'], 'ifwordsfb' => $diary['ifwordsfb'], 'postdate' => $timestamp);
 pwQuery::insert('pw_diary', $pwSQL);
 $did = $db->insert_id();
 $db->update("UPDATE pw_diarytype SET num=num+1 WHERE uid=" . S::sqlEscape($winduid) . " AND dtid=" . S::sqlEscape($dtid));
 //更新分类日志数
 //*=======拷贝图片待优化===========*//
 $diaryAttachs = $diary['aid'] ? unserialize($diary['aid']) : array();
 L::loadClass('upload', '', false);
 require_once R_P . 'require/imgfunc.php';
 $uploadSerivce = new PwUpload();
 $ifthumb = 0;
 if ($o_attachdir) {
     if ($o_attachdir == 1) {
         $savedir = "Type_{$attach_ext}";
     } elseif ($o_attachdir == 2) {
         $savedir = 'Mon_' . date('ym');
     } elseif ($o_attachdir == 3) {
         $savedir = 'Day_' . date('ymd');
     }
 }
 foreach ($diaryAttachs as $at) {
     if ($at['type'] == 'img') {
         $a_url = geturl($at['attachurl'], 'show');
         $attach_ext = strtolower(substr(strrchr($a_url[0], '.'), 1));
         $prename = substr(md5($timestamp . randstr(8)), 10, 15);
Beispiel #29
0
     //抢楼
     $robbuildService = L::loadClass("robbuild", 'forum');
     $fieldsdata = array('authorid' => $winduid, 'starttime' => $robstarttime, 'endtime' => $robendtime, 'endbuild' => $robendbuild, 'awardbuilds' => $robawardbuilds, 'postdate' => $timestamp);
     if ($message = $robbuildService->checkAddData($foruminfo['allowrob'], $fieldsdata)) {
         Showmsg($message);
     }
     $robbuildService->initData($fieldsdata);
     $postdata->setStatus('2');
     $postdata->setStatus('7');
 }
 L::loadClass('attupload', 'upload', false);
 /*上传错误检查
 	$return = PwUpload::checkUpload();
 	$return !== true && Showmsg($return);
 	end*/
 if (PwUpload::getUploadNum() || $flashatt) {
     S::gp(array('savetoalbum', 'albumid'), 'P', 2);
     $postdata->att = new AttUpload($winduid, $flashatt, $savetoalbum, $albumid);
     $postdata->att->check();
 }
 $postdata->iscontinue = (int) $iscontinue;
 $topicpost->execute($postdata);
 $tid = $topicpost->getNewId();
 // defend start
 CloudWind::yunUserDefend('postthread', $winduid, $windid, $timestamp, $cloud_information[1] ? $timestamp - $cloud_information[1] : 0, $tid ? 101 : 102, '', $postdata->data['content'], '', '');
 // defend end
 defined('AJAX') && ($pinfo = $pinfo . $tid);
 if ($postSpecial) {
     $postSpecial->insertData($tid);
 }
 if ($postTopic) {
Beispiel #30
0
 function updateIcon($uid)
 {
     global $atc_attachment_name, $db_ifftp;
     $uid = intval($uid);
     if ($uid < 1 || !S::isArray($_FILES)) {
         return $this->buildResponse(USER_INVALID_PARAMS);
     }
     ACloud_Sys_Core_Common::setGlobal('customized_current_uid', $uid);
     $user = $this->getCurrentUser();
     if (!$user->isLogin()) {
         return $this->buildResponse(USER_NOT_LOGIN);
     }
     $ext = strtolower(substr(strrchr($_FILES['icon']['name'], '.'), 1));
     L::loadClass('faceupload', 'upload', false);
     $face = new FaceUpload($user->uid);
     $icondb = PwUpload::upload($face);
     require_once R_P . 'require/showimg.php';
     $udir = str_pad(substr($user->uid, -2), 2, '0', STR_PAD_LEFT);
     if (!in_array(strtolower($ext), array('gif', 'jpg', 'jpeg', 'png', 'bmp'))) {
         return $this->buildResponse(USER_UPLOAD_CONTENT_ERROR);
     }
     $filename = "{$user->uid}.{$ext}";
     $sourceFilename = "{$user->uid}_tmp.{$ext}";
     $sourceDir = "upload/{$udir}/";
     $middleDir = "upload/middle/{$udir}/";
     $smallDir = "upload/small/{$udir}/";
     $img_w = $img_h = 0;
     $sourceFile = PwUpload::savePath($db_ifftp, $sourceFilename, $sourceDir);
     $middleFile = PwUpload::savePath($db_ifftp, $filename, $middleDir);
     PwUpload::createFolder(dirname($middleFile));
     PwUpload::movefile($sourceFile, $middleFile);
     require_once R_P . 'require/imgfunc.php';
     if (!($img_size = GetImgSize($middleFile))) {
         P_unlink($middleFile);
         return $this->buildResponse(USER_UPLOAD_CONTENT_ERROR);
     }
     list($img_w, $img_h) = getimagesize($middleFile);
     $smallFile = PwUpload::savePath($db_ifftp, $filename, $smallDir);
     $s_ifthumb = 0;
     PwUpload::createFolder(dirname($smallFile));
     if ($ext == 'gif') {
         L::loadClass('gifdecoder', 'utility', false);
         L::loadClass('gif', 'utility', false);
         $gifDecoder = new GIFDecoder($data);
         $frames = $gifDecoder->GIFGetFrames();
         if (!empty($frames)) {
             foreach ($frames as $key => $value) {
                 $frames[$key] = makeAvatarGifThumb($value, $img_w, $img_h, 48, 48);
             }
             $anime = new GIFEncoder($frames, $gifDecoder->GIFGetDelays(), $gifDecoder->GIFGetLoop(), $gifDecoder->GIFGetDisposal(), $gifDecoder->GIFGetTransparentR(), $gifDecoder->GIFGetTransparentG(), $gifDecoder->GIFGetTransparentB(), 'bin');
             $newGifData = $anime->getAnimation();
             PwUpload::createFolder(dirname($smallFile));
             writeover($smallFile, $newGifData);
             $s_ifthumb = 1;
         }
     } elseif (MakeThumb($middleFile, $smallFile, 48, 48)) {
         $s_ifthumb = 1;
     }
     if ($db_ifftp) {
         PwUpload::movetoftp($middleFile, $middleDir . $filename);
         $s_ifthumb && PwUpload::movetoftp($smallFile, $smallDir . $filename);
     }
     $user_a = explode('|', $user->icon);
     $user_a[2] = $img_w;
     $user_a[3] = $img_h;
     $usericon = setIcon("{$udir}/{$user->uid}.{$ext}", 3, $user_a);
     $userService = L::loadClass('UserService', 'user');
     /* @var $userService PW_UserService */
     $userService->update($user->uid, array('icon' => $usericon));
     list($iconurl) = showfacedesign($usericon, 1, 's');
     return $this->buildResponse(0, array('icon' => $iconurl));
 }