Beispiel #1
0
 function _getElement()
 {
     if (!$this->_element) {
         $this->_element = L::loadClass('element');
     }
     return $this->_element;
 }
Beispiel #2
0
 function getAtFeedByUserNames($usernames)
 {
     $data = array();
     if (!S::isArray($usernames)) {
         return $data;
     }
     $userService = L::loadClass('userservice', 'user');
     $users = $userService->getByUserNames($usernames);
     if (S::isArray($users)) {
         $userIds = array();
         foreach ($users as $k => $v) {
             $userIds[$v['uid']] = $v['username'];
         }
         $ouserdataDb = $this->_getOuserdataDB();
         $atFeeds = (array) $ouserdataDb->findUserAtPrivacy(array_keys($userIds));
         if (S::isArray($atFeeds)) {
             foreach ($atFeeds as $v) {
                 $data[$v['uid']] = array('at_isfeed' => $v['at_isfeed'], 'username' => $userIds[$v['uid']]);
             }
         }
         foreach ($userIds as $uid => $username) {
             $data[$uid] or $data[$uid] = array('at_isfeed' => 0, 'username' => $username);
         }
     }
     return $data;
 }
Beispiel #3
0
 function topicPost($tid, $postdata)
 {
     global $timestamp, $winduid, $windid;
     if (!$this->info) {
         return false;
     }
     $this->_db->update("INSERT INTO pw_argument SET " . S::sqlSingle(array('tid' => $tid, 'cyid' => $this->info['id'], 'postdate' => $timestamp, 'lastpost' => $timestamp)));
     if ($postdata['ifcheck'] > 0) {
         require_once R_P . 'u/require/core.php';
         //tnum加一
         //* $this->_db->update("UPDATE pw_colonys SET tnum=tnum+'1',pnum=pnum+'1',todaypost=todaypost+'1' WHERE id=" . S::sqlEscape($this->cyid));
         $this->_db->update(pwQuery::buildClause("UPDATE :pw_table SET tnum=tnum+1,pnum=pnum+1,todaypost=todaypost+1 WHERE id=:id", array('pw_colonys', $this->cyid)));
         $this->info['tnum']++;
         $this->info['pnum']++;
         updateGroupLevel($this->cyid, $this->info);
         if ($this->info['ifopen']) {
             $weiboService = L::loadClass('weibo', 'sns');
             /* @var $weiboService PW_Weibo */
             $weiboContent = substrs(stripWindCode($postdata['content']), 125);
             $weiboExtra = array('cyid' => $this->cyid, 'title' => stripslashes($postdata['title']), 'cname' => $this->info['cname']);
             $weiboService->send($winduid, $weiboContent, 'group_article', $tid, $weiboExtra);
         }
     }
     //更新群成员表里面的最后发言时间
     $this->_db->update("UPDATE pw_cmembers SET lastpost=" . S::sqlEscape($timestamp) . " WHERE uid=" . S::sqlEscape($winduid));
 }
Beispiel #4
0
function CheckUserTool($uid, $tooldb)
{
    global $db, $groupid, $credit;
    if (!$tooldb['state']) {
        Showmsg('tool_close');
    }
    $condition = unserialize($tooldb['conditions']);
    if ($condition['group'] && strpos($condition['group'], ",{$groupid},") === false) {
        Showmsg('tool_grouplimit');
    }
    $userService = L::loadClass('UserService', 'user');
    /* @var $userService PW_UserService */
    $userdb = $userService->get($uid, false, true);
    require_once R_P . 'require/credit.php';
    $creditdb = $credit->get($uid, 'CUSTOM');
    foreach ($condition['credit'] as $key => $value) {
        if ($value) {
            if (is_numeric($key)) {
                $creditdb[$key] < $value && Showmsg('tool_creditlimit');
            } elseif ($userdb[$key] < $value) {
                Showmsg('tool_creditlimit');
            }
        }
    }
}
Beispiel #5
0
 function syncredit($arr)
 {
     if (is_array($arr)) {
         foreach ($arr as $uid => $setv) {
             $updateMemberData = array();
             foreach ($setv as $cid => $value) {
                 if (is_numeric($cid)) {
                     $value = intval($value);
                     /**
                     						$this->db->pw_update(
                     							"SELECT uid FROM pw_membercredit WHERE uid=" . S::sqlEscape($uid) . ' AND cid=' . S::sqlEscape($cid),
                     							"UPDATE pw_membercredit SET value=" . S::sqlEscape($value) .  ' WHERE uid=' . S::sqlEscape($uid) . ' AND cid=' . S::sqlEscape($cid),
                     							"INSERT INTO pw_membercredit SET " . S::sqlSingle(array('uid' => $uid, 'cid' => $cid, 'value' => $value))
                     						);
                     						**/
                     $this->db->pw_update("SELECT uid FROM pw_membercredit WHERE uid=" . S::sqlEscape($uid) . ' AND cid=' . S::sqlEscape($cid), pwQuery::updateClause('pw_membercredit', 'uid=:uid AND cid=:cid', array($uid, $cid), array('value' => $value)), pwQuery::insertClause('pw_membercredit', array('uid' => $uid, 'cid' => $cid, 'value' => $value)));
                 } elseif (in_array($cid, array('money', 'rvrc', 'credit', 'currency'))) {
                     $cid == 'rvrc' && ($value *= 10);
                     $updateMemberData[$cid] = intval($value);
                 }
             }
             if ($updateMemberData) {
                 $userService = L::loadClass('UserService', 'user');
                 /* @var $userService PW_UserService */
                 $userService->update($uid, array(), $updateMemberData);
             }
         }
     }
     return new ApiResponse(1);
 }
 function _getDataAnalyseService()
 {
     if (!$this->_dataAnalyseService) {
         $this->_dataAnalyseService = L::loadClass('datanalyseService', 'datanalyse');
     }
     return $this->_dataAnalyseService;
 }
 function update($uploaddb)
 {
     $fieldService = L::loadClass('ActivityField', 'activity');
     if ($this->tid) {
         $defaultAttach = $userAttach = array();
         foreach ($uploaddb as $key => $value) {
             if ($value['id']) {
                 $attach = array();
                 $attach = $fieldService->getField($value['id']);
                 $this->attachs[$attach['fieldname']] = $value['fileuploadurl'];
                 if ($attach['fieldname'] && $attach['ifdel'] == 1) {
                     $userAttach[$attach['fieldname']] = $value['fileuploadurl'];
                 } elseif ($attach['fieldname'] && !$attach['ifdel']) {
                     $defaultAttach[$attach['fieldname']] = $value['fileuploadurl'];
                 }
             }
         }
         $defaultValueTableName = getActivityValueTableNameByActmid();
         $userDefinedValueTableName = getActivityValueTableNameByActmid($this->actmid, 1, 1);
         if ($defaultAttach) {
             $this->db->update("UPDATE {$defaultValueTableName} SET " . S::sqlSingle($defaultAttach) . " WHERE tid=" . S::sqlEscape($this->tid));
         }
         if ($userAttach) {
             $this->db->update("UPDATE {$userDefinedValueTableName} SET " . S::sqlSingle($userAttach) . " WHERE tid=" . S::sqlEscape($this->tid));
         }
     } else {
         foreach ($uploaddb as $key => $value) {
             $this->attachs['fileuploadurl'] = $value['fileuploadurl'];
         }
     }
     return true;
 }
Beispiel #8
0
 /**
  * 上传csv文件到服务器端
  *
  */
 function _uploadCsv()
 {
     L::loadClass('csvupload', 'upload', false);
     $csvupload = new CsvUpload($this->_uid);
     PwUpload::upload($csvupload);
     $this->_filename = $csvupload->pathname;
 }
Beispiel #9
0
 function update($uploaddb)
 {
     global $windid, $winduid, $timestamp, $pintro;
     foreach ($uploaddb as $key => $value) {
         $this->attachs[] = array('aid' => $this->aid, 'pintro' => $pintro[$value['id']] ? $pintro[$value['id']] : substr($value['name'], 0, strrpos($value['name'], '.')), 'path' => $value['fileuploadurl'], 'uploader' => $windid, 'uptime' => $timestamp, 'ifthumb' => $value['ifthumb']);
     }
     if ($this->attachs) {
         $this->db->update("INSERT INTO pw_cnphoto (aid,pintro,path,uploader,uptime,ifthumb) VALUES " . S::sqlMulti($this->attachs));
         $this->pid = $this->db->insert_id();
         $cnalbum = $this->db->get_one("SELECT * FROM pw_cnalbum WHERE aid=" . S::sqlEscape($this->aid));
         if ($this->atype) {
             if (!$cnalbum['private']) {
                 updateDatanalyse($this->pid, 'groupPicNew', $timestamp);
             }
         } else {
             $statistics = L::loadClass('Statistics', 'datanalyse');
             $statistics->photouser($winduid, count($this->attachs));
         }
         if (isset($cnalbum['lastphoto']) && !$cnalbum['lastphoto']) {
             $lastphoto = $this->getLastPhotoThumb();
             $lastphotosqlAdd = ",lastphoto= " . S::sqlEscape($lastphoto);
         }
         $this->db->update("UPDATE pw_cnalbum SET photonum=photonum+" . S::sqlEscape(count($this->attachs)) . ",lasttime=" . S::sqlEscape($timestamp) . $lastphotosqlAdd . " WHERE aid=" . S::sqlEscape($this->aid));
     }
     return true;
 }
Beispiel #10
0
function getSendToUsernames($type, $tid)
{
    global $windid, $db;
    $usernames = array();
    if (!$type || !$tid) {
        return $usernames;
    }
    $remindUsernames = $db->get_value("SELECT db_value FROM pw_config WHERE db_name = 'report_remind'");
    $remindUsernames = $remindUsernames ? unserialize($remindUsernames) : array();
    foreach ($remindUsernames as $key => $value) {
        if ($value['username'] == $windid) {
            continue;
        }
        $usernames[] = $value['username'];
    }
    if ($type != 'topic') {
        return $usernames;
    }
    $_cacheService = Perf::gatherCache('pw_threads');
    $threads = $_cacheService->getThreadByThreadId($tid);
    $fid = $threads['fid'];
    L::loadClass('forum', 'forum', false);
    $forumService = new PwForum($fid);
    $foruminfo = $forumService->foruminfo;
    $forumadmins = $foruminfo['forumadmin'];
    $forumadmins = explode(',', $forumadmins);
    foreach ($forumadmins as $forumadmin) {
        if (!$forumadmin || $forumadmin == $windid) {
            continue;
        }
        $usernames[] = $forumadmin;
    }
    return $usernames;
}
Beispiel #11
0
 function _render()
 {
     $layoutService = L::loadClass('layout', 'framework');
     $layoutService->init($this->_viewPath, $this->_layoutFile, $this->_layoutExt);
     $layoutService->setPartial($this->_partial);
     $layoutService->setTemplate($this->_template ? $this->_template : $this->_controller . '.' . $this->_action);
     $layoutService->display($this->_layoutFile, $this->_viewer);
 }
 function run()
 {
     $tid = $this->getVar('tid');
     $uid = $this->getVar('winduid');
     $pid = $this->getVar('pid');
     $replyRewardRecordService = L::loadClass('ReplyRewardRecord', 'forum');
     $GLOBALS['isReplyRewardSuccess'] = $replyRewardRecordService->rewardReplyUser($uid, $tid, $pid);
 }
Beispiel #13
0
 /**
  * 根据日志ID数组获得日志信息
  * @return array
  */
 function _getDataByTags()
 {
     if (empty($this->tags)) {
         return array();
     }
     $userService = L::loadClass('UserService', 'user');
     /* @var $userService PW_UserService */
     return $userService->getUsersWithMemberDataByUserIds($this->tags);
 }
Beispiel #14
0
 /**
  * 获得根据类别评价类型
  * @return array
  */
 function _getExtendActions()
 {
     global $db_ratepower;
     $rateSets = unserialize($db_ratepower);
     if ($rateSets[2]) {
         $rate = L::loadClass('rate', 'rate');
         $_tmp = $rate->getRateDiaryHotTypes();
     }
     return is_array($_tmp) ? array_keys($_tmp) : array();
 }
 /**
  * 获得类别评价类型
  * 	1 帖子评价
  *  2 日志评价
  *  3 相片评价
  * @return array
  */
 function _getExtendActions()
 {
     global $db_ratepower;
     $rateSets = unserialize($db_ratepower);
     if ($rateSets[1]) {
         $rate = L::loadClass('rate', 'rate');
         $_tmp = $rate->getRatePictureHotTypes();
     }
     return array_keys($_tmp);
 }
 function _getSharesTypes()
 {
     $typeService = L::loadClass('SharelinkstypeService', 'site');
     $ret = $typeService->getAllTypes();
     $result['all'] = '所有分类';
     foreach ($ret as $value) {
         $result[$value['stid']] = $value['name'];
     }
     return $result;
 }
Beispiel #17
0
 function deluser($uids)
 {
     $user = L::loadClass('ucuser', 'user');
     $user->delUserByIds($uids);
     $this->db->query("DELETE FROM " . $this->tablepre . "member WHERE member_id IN ({$uids})");
     $this->db->query("DELETE FROM " . $this->tablepre . "store WHERE member_id IN ({$uids})");
     /*删除未完,还有其他数据需要删除*/
     return API_RETURN_SUCCEED;
     return new ApiResponse(1);
 }
 /**
  * @return PlatformApiClient
  */
 function _getPlatformApiClient()
 {
     static $client = null;
     if (null === $client) {
         global $db_sitehash, $db_siteownerid;
         L::loadClass('client', 'utility/platformapisdk', false);
         $client = new PlatformApiClient($db_sitehash, $db_siteownerid);
     }
     return $client;
 }
Beispiel #19
0
 function logColonys($operate, $fields)
 {
     global $db_operate_log;
     isset($fields['insert_id']) && ($fields['id'] = $fields['insert_id']);
     if (!$db_operate_log || !in_array('log_colonys', $db_operate_log) || !isset($fields['id'])) {
         return false;
     }
     $service = L::loadClass('operatelog', 'utility');
     $service->logColonys($operate, $fields);
 }
Beispiel #20
0
 function syncData($operate, $fields)
 {
     global $db_sphinx;
     isset($fields['insert_id']) && ($fields['pid'] = $fields['insert_id']);
     if (!isset($db_sphinx['sync']['sync_posts']) || !isset($fields['pid'])) {
         return false;
     }
     $service = L::loadClass('realtimesearcher', 'search/userdefine');
     $service->syncData('post', $operate, $fields['pid']);
 }
 function getSourceUrl($sourceId)
 {
     global $db_bbsurl;
     $diaryService = L::loadClass('Diary', 'diary');
     /* @var $diaryService PW_Diary */
     $diaryTemp = $diaryService->get($sourceId);
     if (!$diaryTemp) {
         return '';
     }
     return $db_bbsurl . '/apps.php?q=diary&a=detail&did=' . $sourceId . '&uid=' . $diaryTemp['uid'];
 }
Beispiel #22
0
 function _setPoster()
 {
     L::loadClass('activeupload', 'upload', false);
     $att = new activePoster($this->data['cid']);
     PwUpload::upload($att);
     if ($poster = $att->getImgUrl()) {
         if ($this->data['poster']) {
             pwDelatt($this->data['poster'], $GLOBALS['db_ifftp']);
         }
         $this->data['poster'] = $poster;
     }
 }
Beispiel #23
0
 function _getSmileParseConfig()
 {
     if (null === $this->_smileParseConfig) {
         $parseConfig = array();
         $smileService = L::loadClass('smile', 'smile');
         foreach ($smileService->findByType() as $smile) {
             $parseConfig[$smile['tag']] = '<img src="' . $smile['url'] . '" style="vertical-align:top;margin:0 3px 0 0;" />';
             //@todo hard coded
         }
         $this->_smileParseConfig = $parseConfig;
     }
     return $this->_smileParseConfig;
 }
Beispiel #24
0
 function run()
 {
     $winduid = $this->getVar('winduid');
     $winddb = $this->getVar('winddb');
     $db_md_ifopen = $this->getVar('db_md_ifopen');
     if ($db_md_ifopen) {
         require_once R_P . 'require/functions.php';
         doMedalBehavior($winduid, 'continue_thread_post');
         doMedalBehavior($winduid, 'continue_post', $winddb['lastpost']);
         $medalservice = L::loadClass('medalservice', 'medal');
         $medalservice->runAutoMedal($winddb, 'post', $winddb['postnum'], 1);
     }
 }
Beispiel #25
0
 /**
  * @param $_summary the $_summary to set
  */
 function set_summary($_summary, $convert)
 {
     if ($_summary) {
         $_summary = stripWindCode($_summary);
         $_summary = strip_tags($_summary);
         $_summary = str_replace(array('"', "\n", "\r", '&nbsp;', '&amp;', '&lt;', '', '&#160;'), '', $_summary);
         $_summary = substrs($_summary, 255);
         if ($convert) {
             $wordsfb = L::loadClass('FilterUtil');
             $_summary = $wordsfb->convert($_summary);
         }
         $this->_summary = trim($_summary);
     }
 }
Beispiel #26
0
 /**
  * 根据联系人邮件列表获得好友列表
  * @param Array $emailList
  * @return Array:
  */
 function getUsersFromEmailList($emailList)
 {
     $result = array();
     if (!empty($emailList) && is_array($emailList)) {
         $userService = L::loadClass('UserService', 'user');
         /* @var $userService PW_UserService */
         foreach ($userService->getByEmails($emailList) as $rt) {
             $rt['face'] = showfacedesign($rt['icon'], '1', 's');
             $rt['face'] = $rt['face'][0];
             $result[$rt['uid']] = $rt;
         }
     }
     return $result;
 }
 /**
  * @param string $type
  * @param int $num
  */
 function _getData($type, $num)
 {
     switch ($type) {
         case '':
         case 'new':
             $write = L::loadDB('owritedata', 'sns');
             return $write->getNewData($num);
         case 'comment':
             $datanalyse = L::loadClass('datanalyseService', 'datanalyse');
             return $datanalyse->getDataByAction('owrite', 'writeComment', $num);
         default:
             return;
     }
 }
Beispiel #28
0
/**
 * 
 * @author pw team, Nov 5, 2010
 * @copyright 2003-2010 phpwind.net. All rights reserved.
 * @version 
 * @package default
 */
function sendDataToPlatform($method, $params)
{
    if ($method == '') {
        return false;
    }
    L::loadClass('client', 'utility/platformapisdk', false);
    //require_once(R_P.'api/class_json.php');
    L::loadClass('json', 'utility', false);
    $PlatformApiClient = new PlatformApiClient($GLOBALS['db_sitehash'], $GLOBALS['db_siteownerid']);
    $returnData = $PlatformApiClient->get($method, $params);
    //return $returnData;
    $Json = new Services_JSON();
    return $Json->decode($returnData);
}
 function _postThread($id, $postAudit, $expand)
 {
     $postVerifyService = $this->getPostVerifyService();
     $postVerifyService->insertPostVerify(1, $id, 0);
     $GLOBALS['db']->query("UPDATE pw_threads SET ifcheck=0 WHERE tid=" . CLOUDWIND_SECURITY_SERVICE::sqlEscape($id));
     if (class_exists("Perf")) {
         Perf::gatherInfo('changeThreadWithForumIds', array('fid' => $expand['fid']));
         // 8.3+
     } else {
         $threadList = L::loadClass("threadlist", 'forum');
         $threadList && $threadList->refreshThreadIdsByForumId($expand['fid']);
     }
     return true;
 }
 function getInstance($uid, $aid, $num)
 {
     $saveAttach = null;
     L::loadClass('photo', 'colony', false);
     $photoService = new PW_Photo($uid, 0, 1, 0);
     $albumInfo = $photoService->getAlbumInfo($aid);
     $photonums = $albumInfo['photonum'];
     $GLOBALS += L::config(null, 'o_config');
     if ($albumInfo && (!$GLOBALS['o_maxphotonum'] || $albumInfo['photonum'] + $num <= $GLOBALS['o_maxphotonum'])) {
         L::loadClass('photoupload', 'upload', false);
         $saveAttach = new saveAttach(new PhotoUpload($aid));
     }
     return $saveAttach;
 }