示例#1
0
 /**
  * 上传csv文件到服务器端
  *
  */
 function _uploadCsv()
 {
     L::loadClass('csvupload', 'upload', false);
     $csvupload = new CsvUpload($this->_uid);
     PwUpload::upload($csvupload);
     $this->_filename = $csvupload->pathname;
 }
示例#2
0
<?php

!defined('P_W') && exit('Forbidden');
if (empty($_GET['step'])) {
    define('AJAX', 1);
    list($db_upload, $db_imglen, $db_imgwidth, $db_imgsize) = explode("\t", $db_upload);
    S::gp(array('uid', 'verify'));
    $swfhash = GetVerify($uid);
    checkVerify('swfhash');
    L::loadClass('faceupload', 'upload', false);
    $face = new FaceUpload($uid);
    PwUpload::upload($face);
    $uploaddb = $face->getAttachs();
    echo 'success';
    //ajax_footer();
    //echo $db_bbsurl . '/' . $attachpath . '/' . $uploaddb['fileuploadurl'] . '?' . $timestamp;
    //exit();
} else {
    L::loadClass('upload', '', false);
    $ext = strtolower(substr(strrchr($_GET['filename'], '.'), 1));
    $udir = str_pad(substr($winduid, -2), 2, '0', STR_PAD_LEFT);
    //$source = PwUpload::savePath(0, "{$winduid}_tmp.$ext", "upload/$udir/");
    if (!in_array(strtolower($ext), array('gif', 'jpg', 'jpeg', 'png', 'bmp'))) {
        Showmsg('undefined_action');
    }
    /*if (!file_exists($source)) {
    		Showmsg('头像保存失败,图片大小请不要超过2M!');
    	}*/
    $data = $_SERVER['HTTP_RAW_POST_DATA'] ? $_SERVER['HTTP_RAW_POST_DATA'] : file_get_contents('php://input');
    if ($data) {
        S::gp(array('from'));
示例#3
0
function stopicUploadImg($k)
{
    global $db_bbsurl;
    $img = new StopicUpload($k);
    $returnImg = PwUpload::upload($img);
    if (!is_array($returnImg) || count($returnImg) == 0) {
        return false;
    }
    $imageUrl = geturl($returnImg[0]['fileuploadurl']);
    return $imageUrl[0];
}
示例#4
0
!defined('P_W') && exit('Forbidden');
define('AJAX', 1);
S::gp(array('type'));
reset($_FILES);
$filekey = key($_FILES);
$aid = substr($filekey, strpos($filekey, '_') + 1);
if (!$aid) {
    echo 'fail';
    ajax_footer();
}
$modifyattach = getAttModifyFactory($type, $aid);
if (($return = $modifyattach->check()) !== true) {
    showExtraMsg($return);
}
PwUpload::upload($modifyattach);
echo "ok\t" . $modifyattach->getAttachName();
ajax_footer();
function getAttModifyFactory($type, $aid)
{
    if ($type == 'active') {
        L::loadClass('activeupload', 'upload', false);
        return new ActiveModify($aid);
    }
    if ($type == 'cms') {
        require_once R_P . 'mode/cms/lib/upload/articleupload.class.php';
        return new ArticleModify($aid);
    }
    if ($type && file_exists(R_P . "require/extents/attach/{$type}modify.class.php")) {
        $class = $type . 'Modify';
        require_once S::escapePath(R_P . "require/extents/attach/{$type}modify.class.php");
示例#5
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));
     //会员资讯缓存
示例#6
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');
}
 /**
  * 设置附件
  * @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;
 }
示例#8
0
 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']);
 }
示例#9
0
 /**
  * 操作数据库
  * @param int $tid 帖子id
  * @param int $fid 版块id
  */
 function insertData($tid, $fid)
 {
     /*操作数据库*/
     global $action, $atc_title;
     $this->data['default'] = $this->data['act']['0'];
     $this->data['default']['tid'] = $tid;
     $this->data['default']['fid'] = $fid;
     $this->data['default']['actmid'] = $this->actmid;
     $this->data['user'] = array();
     !S::isArray($this->data['act']['1']) && ($this->data['act']['1'] = array());
     foreach ($this->data['act']['1'] as $key => $value) {
         if ($value) {
             $this->data['user'][$key] = $value;
         }
     }
     $this->data['user']['tid'] = $tid;
     $this->data['user']['fid'] = $fid;
     unset($this->data['act']);
     $defaultValueTableName = getActivityValueTableNameByActmid();
     $userDefinedValueTableName = getActivityValueTableNameByActmid($this->actmid, 1, 1);
     $this->db->pw_update("SELECT tid FROM {$defaultValueTableName} WHERE tid=" . S::sqlEscape($tid), "UPDATE {$defaultValueTableName} SET " . S::sqlSingle($this->data['default']) . "WHERE tid=" . S::sqlEscape($tid), "INSERT INTO {$defaultValueTableName} SET " . S::sqlSingle($this->data['default']));
     $this->db->pw_update("SELECT tid FROM {$userDefinedValueTableName} WHERE tid=" . S::sqlEscape($tid), "UPDATE {$userDefinedValueTableName} SET " . S::sqlSingle($this->data['user']) . "WHERE tid=" . S::sqlEscape($tid), "INSERT INTO {$userDefinedValueTableName} SET " . S::sqlSingle($this->data['user']));
     $subject = $this->db->get_value('SELECT subject FROM pw_threads WHERE tid=' . S::sqlEscape($tid));
     if ($subject) {
         $this->db->update('UPDATE pw_activitypaylog SET subject=' . S::sqlEscape($subject) . ' WHERE tid=' . S::sqlEscape($tid));
     }
     /*选择支付宝+没有绑定支付宝+没有通过支付宝实名认证 or 创建AA活动号*/
     if ($this->data['default']['paymethod'] == 1) {
         $tradeinfo = $this->db->get_one("SELECT tradeinfo FROM pw_memberinfo WHERE uid=" . S::sqlEscape($this->winduid));
         $tradeinfo = unserialize($tradeinfo['tradeinfo']);
         $alipay = $tradeinfo['alipay'];
         $isBinded = $tradeinfo['isbinded'];
         $isCertified = $tradeinfo['iscertified'];
         if (!$alipay || $isBinded != 'T' || $isCertified != 'T') {
             //选择支付宝+没有绑定支付宝+没有通过支付宝实名认证
             $this->db->update("UPDATE {$defaultValueTableName} SET iscertified=0 WHERE tid=" . S::sqlEscape($tid));
         } elseif ($alipay && $isBinded == 'T' && $isCertified == 'T') {
             //绑定支付宝+通过支付宝实名认证
             $this->db->update("UPDATE {$defaultValueTableName} SET iscertified=1 WHERE tid=" . S::sqlEscape($tid));
             require_once R_P . 'lib/activity/alipay_push.php';
             $alipayPush = new AlipayPush();
             if ($action == 'new') {
                 $alipayPush->create_aa_payment($tid, $this->winduid, $this->actmid, $atc_title);
                 //创建AA活动号
             } elseif ($action == 'modify') {
                 $alipayPush->modify_aa_payment($tid, $this->actmid, $atc_title);
                 //修改AA活动号
             }
         }
     }
     /*选择支付宝+没有绑定支付宝+没有通过支付宝实名认证 or 创建AA活动号*/
     /*附件上传*/
     L::loadClass('activityupload', 'upload', false);
     $img = new ActivityUpload($tid, $this->actmid);
     PwUpload::upload($img);
     require_once R_P . 'require/functions.php';
     pwFtpClose($GLOBALS['ftp']);
 }
 function postThread($uid, $fid, $subject, $content)
 {
     global $winddb, $winduid, $windid, $groupid, $_G, $timestamp, $pwforum, $pwpost, $uploadcredit, $uploadmoney, $db_uploadfiletype, $_time;
     $timestamp = time();
     $_time = array('hours' => get_date($timestamp, 'G'), 'day' => get_date($timestamp, 'j'), 'week' => get_date($timestamp, 'w'));
     list($uid, $fid, $subject, $content) = array(intval($uid), intval($fid), trim($subject), trim($content));
     if ($uid < 1 || $fid < 1 || !$subject || !$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);
     }
     L::loadClass('forum', 'forum', false);
     $pwforum = new PwForum($fid);
     if (!$pwforum->isForum()) {
         return $this->buildResponse(THREAD_FORUM_NOT_EXIST);
     }
     list($uploadcredit, $uploadmoney, , ) = explode("\t", $pwforum->forumset['uploadset']);
     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('topicpost', 'forum', false);
     $topicpost = new topicPost($pwpost);
     $topicpost->check();
     $postdata = new topicPostData($pwpost);
     $postdata->setWtype('', '', $pwforum->foruminfo['t_type'], $pwforum->foruminfo['topictype']);
     $postdata->setTitle($subject);
     $postdata->setContent($content);
     $postdata->setConvert(1, 1);
     $postdata->setTags('');
     $postdata->setDigest('');
     $postdata->setTopped('');
     $postdata->setIfsign(1, 0);
     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->buildResponse(THREAD_USER_NOT_RIGHT);
         }
         list($windVersion) = explode(',', WIND_VERSION);
         if ($windVersion && $windVersion < '8.5') {
             PwUpload::upload($postdata->att);
             $postdata->att->transfer();
         }
     }
     $topicpost->execute($postdata);
     $tid = $topicpost->getNewId();
     return $this->buildResponse(0, array('tid' => $tid));
 }
示例#11
0
         if (array_key_exists('replace_' . $key, $_FILES)) {
             $db_attachnum++;
             $replacedb[$key] = $oldattach[$key];
         } elseif ($value['desc'] != $v['desc']) {
             $runsql[] = 'UPDATE pw_attachs SET ' . S::sqlSingle(array('needrvrc' => $v['needrvrc'], 'descrip' => $v['desc'], 'special' => $v['special'], 'ctype' => $v['ctype'])) . ' WHERE aid=' . S::sqlEscape($key);
         }
     }
 }
 $aids = $attachs = array();
 L::loadClass('diaryupload', 'upload', false);
 if (PwUpload::getUploadNum() || $flashatt) {
     S::gp(array('savetoalbum', 'albumid'), 'P', 2);
     $diaryUpload = new DiaryUpload($winduid, $flashatt, $savetoalbum, $albumid);
     $diaryUpload->check();
     $diaryUpload->setReplaceAtt($replacedb);
     PwUpload::upload($diaryUpload);
     $aids = $diaryUpload->getAids();
     $attachs = $diaryUpload->getAttachs();
     $attachIds = $diaryUpload->getAttachIds();
     $ifupload = $diaryUpload->ifupload;
     if ($oldattach && $diaryUpload->replacedb) {
         foreach ($diaryUpload->replacedb as $key => $value) {
             $oldattach[$key] = $value;
         }
     }
 }
 if ($attachs) {
     foreach ($attachs as $key => $value) {
         $oldattach[$key] = $value;
     }
     $userService = L::loadClass('UserService', 'user');
示例#12
0
<?php

!function_exists('readover') && exit('Forbidden');
if (empty($_GET['step'])) {
    list($db_upload, $db_imglen, $db_imgwidth, $db_imgsize) = explode("\t", $db_upload);
    S::gp(array('uid', 'verify'));
    $swfhash = GetVerify($uid);
    checkVerify('swfhash');
    $db_uploadfiletype = array();
    $db_uploadfiletype['gif'] = $db_uploadfiletype['jpg'] = $db_uploadfiletype['bmp'] = $db_uploadfiletype['png'] = $db_imgsize;
    L::loadClass('upload', '', false);
    $pwupload = new PwUpload(new FaceUpload());
    $pwupload->upload($uid);
    $uploaddb = $pwupload->getAttachs();
    echo $db_bbsurl . '/' . $attachpath . '/' . $uploaddb['fileuploadurl'] . '?' . $timestamp;
    exit;
} else {
    require_once R_P . 'require/functions.php';
    L::loadClass('upload', '', false);
    $ext = strtolower(substr(strrchr($_GET['filename'], '.'), 1));
    $udir = str_pad(substr($winduid, -2), 2, '0', STR_PAD_LEFT);
    $source = PwUpload::savePath($db_ifftp, "{$winduid}_tmp.{$ext}", "upload/{$udir}/");
    if (!file_exists($source)) {
        Showmsg('undefined_action');
    }
    $data = $_SERVER['HTTP_RAW_POST_DATA'] ? $_SERVER['HTTP_RAW_POST_DATA'] : file_get_contents('php://input');
    if ($data) {
        require_once R_P . 'require/showimg.php';
        $filename = "{$winduid}.jpg";
        $normalDir = "upload/{$udir}/";
        $middleDir = "upload/middle/{$udir}/";
示例#13
0
文件: auth.php 项目: jechiy/PHPWind
    }
} elseif ($check_step == 'certificate') {
    //证件认证
    $step = S::getGP('step');
    $authService = L::loadClass('Authentication', 'user');
    if (empty($step)) {
        $certificateTypesHtml = $authService->getCertificateTypeHtml();
    } elseif ($step == 2) {
        S::gp(array('certificate'));
        L::loadClass('certificateupload', 'upload', false);
        !$certificate['number'] && Showmsg("请输入证件编号");
        //删除原有认证
        $certificateInfo = $authService->getCertificateInfoByUid($winduid);
        $certificateInfo && $authService->deleteCertificateById($certificateInfo['id']);
        $certificateUploadBehavior = new CertificateUpload($winduid);
        PwUpload::upload($certificateUploadBehavior);
        $certificateInfo = $authService->getCertificateInfoByUid($winduid);
        $data = array('type' => $certificate['type'], 'number' => $certificate['number'], 'createtime' => $timestamp, 'state' => 1);
        if (!S::isArray($certificateInfo) || !$certificateInfo['attach1'] && !$certificateInfo['attach2']) {
            /*
            $data['uid'] = $winduid;
            $authService->addCertificateInfo($data);
            */
            Showmsg("请上传至少一张证件图片再提交");
        } else {
            $authService->updateCertificateInfo($data, $certificateInfo['id']);
        }
        refreshto("profile.php?action=auth", '提交成功,请等待管理员审核');
    }
}
require_once uTemplate::PrintEot('profile_auth');
示例#14
0
        $mutiupload = new messageMutiUpload($uid);
    } elseif ($type == 'cms') {
        require_once R_P . 'mode/cms/lib/upload/articleupload.class.php';
        $mutiupload = new articleMutiUpload($uid);
    } elseif ($type && file_exists(R_P . "require/extents/attach/{$type}mutiupload.class.php")) {
        $class = $type . 'MutiUpload';
        require_once S::escapePath(R_P . "require/extents/attach/{$type}mutiupload.class.php");
        $mutiupload = new $class($uid);
    } else {
        L::loadClass('attmutiupload', 'upload', false);
        $mutiupload = new AttMutiUpload($uid, intval($_POST['fid']));
    }
    if (($return = $mutiupload->check()) !== true) {
        showExtraMsg($return);
    }
    PwUpload::upload($mutiupload);
    $attachInfo = $mutiupload->getAttachInfo();
    if ($ua && $attachInfo) {
        $attachService = L::loadClass('attachs', 'forum');
        if ($attachInfo['path']) {
            $tmp = $db_ifftp ? $db_ftpweb : $attachpath;
            strpos($attachInfo['path'], "{$tmp}/") === 0 && ($tmpPath = substr($attachInfo['path'], strlen("{$tmp}/")));
            strpos($tmpPath, "thumb/") === 0 && ($tmpPath = substr($tmpPath, 6));
            $tmpPath && ($attachInfo['path'] = $attachService->getThreadAttachMini($tmpPath));
            $attachInfo['attachurl'] = $tmpPath ? $tmpPath : $attachInfo['path'];
        }
    }
    echo pwJsonEncode($attachInfo);
    ajax_footer();
}
function showExtraMsg($msg)
示例#15
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']);
 }
示例#16
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));
 }
示例#17
0
 function uploadPicture($invokePieceId)
 {
     L::loadClass('pushupload', 'upload', false);
     $img = new PushUpload($invokePieceId);
     PwUpload::upload($img);
     pwFtpClose($ftp);
     return $img->getImagePath();
 }
示例#18
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));
 }
示例#19
0
        ajaxExport(array('bool' => false, 'message' => '内容超过限定长度' . $_G['messagecontentsize'] . '字节'));
    }
    $filterUtil = L::loadClass('filterutil', 'filter');
    $atc_content = $filterUtil->convert($atc_content);
    $atc_title = $filterUtil->convert($atc_title);
    $messageInfo = array('create_uid' => $winduid, 'create_username' => $windid, 'title' => $atc_title, 'content' => $atc_content);
    $messageService = L::loadClass("message", 'message');
    if ($messageId = $messageService->sendMessage($winduid, $usernames, $messageInfo)) {
        initJob($winduid, 'doSendMessage', array('user' => $usernames));
        define('AJAX', 1);
        L::loadClass('messageupload', 'upload', false);
        if ($db_allowupload && $_G['allowupload'] && (PwUpload::getUploadNum() || $flashatt)) {
            S::gp(array('savetoalbum', 'albumid'), 'P', 2);
            $messageAtt = new messageAtt($messageId);
            $messageAtt->setFlashAtt($flashatt, $savetoalbum, $albumid);
            PwUpload::upload($messageAtt);
        }
    }
    ajaxExport(array('bool' => true, 'message' => '消息已发送'));
} elseif ('agree' == $action) {
    /* 请求同意  */
    S::gp(array('rids', 'typeid', 'fid', 'cyid', 'check'), 'GP');
    empty($rids) && ajaxExport("非法操作请返回");
    !is_array($rids) && ($rids = explode(',', trim($rids, ',')));
    $fid && !is_array($fid) && ($fid = array($fid));
    $agreeType = $messageServer->getReverseConst($typeid);
    switch ($agreeType) {
        case 'request_friend':
            $return = $friendObj->argeeAddedFriends($winduid, $fid);
            /*xufazhang 2010-07-22 */
            $friendService = L::loadClass('Friend', 'friend');
示例#20
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) {
 function execute()
 {
     PwUpload::upload($this);
 }
示例#22
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));
示例#23
0
 /**
  * 上传相片
  * @param $aid int 相册表ID
  * @return Array 上传相片相关信息
  **/
 function uploadPhoto($aid)
 {
     if (!$this->isPermission && !$this->isSelf()) {
         return 'colony_phototype';
     }
     $albumDao = $this->_getDaoFactory('CnAlbum');
     $photoDao = $this->_getDaoFactory('CnPhoto');
     if (!$aid) {
         $albumcheck = $albumDao->getAlbumNumByUid($this->_uid, 0);
         if (empty($albumcheck)) {
             return 'colony_albumclass';
         } else {
             $userInfo = $this->getUserInfoByUid();
             $data = array('aname' => getLangInfo('app', 'defaultalbum'), 'atype' => 0, 'ownerid' => $this->_uid, 'owner' => $this->_windid, 'lasttime' => $this->_timestamp, 'crtime' => $this->_timestamp);
             $aid = $albumDao->insert($data);
         }
     }
     if (!$aid) {
         return 'colony_albumclass';
     }
     $albumInfo = $albumDao->getAlbumInfo($aid, 0);
     if (empty($albumInfo)) {
         return 'undefined_action';
     }
     $uploadNum = 0;
     foreach ($_FILES as $k => $v) {
         isset($v['name']) && $v['name'] != "" && $uploadNum++;
     }
     //* include_once pwCache::getPath(D_P.'data/bbscache/o_config.php');
     extract(pwCache::getData(D_P . 'data/bbscache/o_config.php', false));
     if ($o_maxphotonum && $albumInfo['photonum'] + $uploadNum > $o_maxphotonum) {
         return 'colony_photofull';
     }
     L::loadClass('photoupload', 'upload', false);
     $img = new PhotoUpload($aid);
     PwUpload::upload($img);
     pwFtpClose($ftp);
     if (!($photos = $img->getAttachs())) {
         return 'colony_uploadnull';
     }
     $photoNum = count($photos);
     $pid = $img->getNewID();
     if (empty($albumInfo['lastphoto'])) {
         $albumDao->update(array('lastphoto' => $img->getLastPhotoThumb()), $aid);
     }
     return array($albumInfo, $pid, $photoNum, $photos);
 }
示例#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);
 }
示例#25
0
 function _setAtt()
 {
     $this->att = new activeAtt($this->data['cid']);
     if ($this->replacedb) {
         $this->att->setReplaceAtt($this->replacedb);
     }
     $this->att->setFlashAtt($_POST['flashatt'], $_POST['savetoalbum'], $_POST['albumid']);
     PwUpload::upload($this->att);
 }