public function editUser($uid) { $api = WindidApi::api('user'); $user = $api->getUser($uid); //你系统的 editUser($user); return true; }
public function __call($method, $args) { if ($this->method == $method) { return $this->value; } $cls = WindidApi::api($this->api); return call_user_func_array(array($cls, $method), $args); }
/** * 学校获取(typeid = 1:小学,2:中学,3:大学) */ public function schoolAction() { list($type, $areaid, $name, $first) = $this->getInput(array('typeid', 'areaid', 'name', 'first')); !$type && ($type = 3); Wind::import('WINDID:service.school.vo.WindidSchoolSo'); $schoolSo = new WindidSchoolSo(); $schoolSo->setName($name)->setTypeid($type)->setFirstChar($first)->setAreaid($areaid); $list = WindidApi::api('school')->searchSchoolData($schoolSo, 1000); exit($list ? Pw::jsonEncode($list) : ''); }
protected function getConfigCacheValue() { $vkeys = array('site', 'components', 'verify', 'attachment', 'reg'); $array = WindidApi::api('config')->fetchConfig($vkeys); $config = array(); foreach ($vkeys as $key => $value) { $config[$value] = array(); } foreach ($array as $key => $value) { $config[$value['namespace']][$value['name']] = $value['vtype'] != 'string' ? unserialize($value['value']) : $value['value']; } return $config; }
private function deleteThread($topic) { $tid = $topic['tid']; $fid = $topic['fid']; $subject = $topic['subject']; $created_userid = $topic['created_userid']; $dm = new PwTopicRecycleDm(); $dm->setTid($tid)->setFid($fid)->setOperateTime(time())->setOperateUsername('system')->setReason('长期断种'); Wekit::load('recycle.PwTopicRecycle')->add($dm); $dm = new PwTopicDm($tid); $dm->setDisabled(2)->setTopped(0)->setDigest(0); Wekit::load('forum.PwThread')->updateThread($dm); $api = WindidApi::api('message'); $api->send($created_userid, '您的种子 ' . $subject . ' 因长期断种已被系统自动移入回收站,如有异议请尽快联系管理员,管理员将根据相关规定决定恢复或彻底删除。', 1); }
/** * 附件存储方式设置列表页 */ public function dostroageAction() { $att_storage = $this->getInput('att_storage', 'post'); $avatar_storage = $this->getInput('avatar_storage', 'post'); /* @var $attService PwAttacmentService */ $attService = Wekit::load('LIB:storage.PwStorage'); $_r = $attService->setStoragesComponents($att_storage); if ($_r !== true) { $this->showError($_r->getError()); } $config = new PwConfigSet('attachment'); $config->set('storage.type', $att_storage)->flush(); $result = WindidApi::api('avatar')->setStorages($avatar_storage); if ($result == '1') { Wekit::C()->setConfig('site', 'avatarUrl', WindidApi::api('avatar')->getAvatarUrl()); } $this->showMessage('ADMIN:success'); }
protected function _beforeAdd() { if (!$this->dm) { return new PwError('USER:user.info.error'); } if (($result = PwUserValidator::isUsernameHasIllegalChar($this->getField('username'))) !== false) { return $result; } if (($result = PwUserValidator::isPwdValid($this->_password, $this->getField('username'))) !== true) { return $result; } if (($result = $this->dm->beforeAdd()) !== true) { $errorCode = $result->getCode(); $var = array(); if ($errorCode == -2) { $windid = WindidApi::api('config'); $config = $windid->getConfig('reg'); $var = array('{min}' => $config['namelength.min'], '{max}' => $config['namelength.max']); } if ($errorCode == -11) { $windid = WindidApi::api('config'); $config = $windid->getConfig('reg'); $var = array('{min}' => $config['passwordlength.min'], '{max}' => $config['passwordlength.max']); } return new PwError('WINDID:code.' . $errorCode, $var); } if (true !== ($result = $this->check())) { return $result; } return true; }
/** * 马甲切换 */ public function changeAction() { $uid = $this->getInput('uid', 'get'); $bp = new App_Majia_MajiaBandingBp($this->loginUser); $result = $bp->doChangeAccount($uid); if ($result instanceof PwError) { $error = $result->getError(); if ($error == '密码失效,请重新绑定') { $this->addMessage(array('reband' => WindUrlHelper::createUrl('app/majia/my/reBand?uid=' . $uid)), 'data'); $this->showError('密码失效,需要重新绑定'); } else { $this->showError($error); } } Wekit::load('SRV:user.srv.PwLoginService')->setLoginCookie(new PwUserBo($uid), $this->getRequest()->getClientIp()); WindidApi::api('user')->synLogin($uid); $this->showMessage('切换成功'); }
/** * 获得area的DS * * @return WindidArea */ private function _loadAreaDs() { return WindidApi::api('area'); }
private function _getWindid() { return WindidApi::api('config'); }
protected function _getWindid() { return WindidApi::api('config'); }
/** * 构建推送的地区库---获取地区库的省/市/区 * * @param int $areaid * @return array */ private function _buildArea($areaid) { $areaSrv = WindidApi::api('area'); $_rout = $areaSrv->getAreaRout($areaid); $_return = array('id' => '', 'rout' => array(array('', ''), array('', ''), array('', ''))); if (!$_rout) { return $_return; } foreach ($_rout as $_k => $_r) { $_return['rout'][$_k] = array($_r['areaid'], $_r['name']); } $_return['id'] = $areaid; return $_return; }
private function _getAppDs() { return WindidApi::api('app'); }
/** * 恢复系统头像 */ public function defaultAvatarAction() { $uid = (int) $this->getInput('uid', 'get'); if (!$uid) { $this->showError('WINDID:fail'); } $api = WindidApi::api('avatar'); if ($api->defaultAvatar($uid) > 0) { $this->showMessage('success'); } $this->showError('WINDID:fail'); }
/** * 设置地区显示 * * @return array */ private function _buildArea($areaid) { $default = array(array('areaid' => '', 'name' => ''), array('areaid' => '', 'name' => ''), array('areaid' => '', 'name' => '')); if (!$areaid) { return $default; } $rout = WindidApi::api('area')->getAreaRout($areaid); return WindUtility::mergeArray($default, $rout); }
function handreg($username, $email, $password, $fs = 1) { error_reporting(~E_ALL); $username = fzr($username); $email = fzr($email); $password = fzr($password); $windid = WindidApi::api('user'); $result = $windid->register($username, $email, $password); if ($result < 1) { //返回信息小于1,说明没有注册成功 $msg = windidMsg($result); //调用错误处理提示 if ($result == "-10") { $remsg['msg'] = $msg; $remsg['jg'] = '-6'; return $remsg; } elseif ($result == "-4" || $result == "-3") { $remsg['msg'] = $msg; $remsg['jg'] = '-2'; return $remsg; } elseif ($result == "-5") { $remsg['msg'] = $msg; $remsg['jg'] = '-3'; return $remsg; } elseif ($result == "-7") { $remsg['msg'] = $msg; $remsg['jg'] = '-4'; return $remsg; } elseif ($result == "-8" || $result == "-9") { $remsg['msg'] = $msg; $remsg['jg'] = '-5'; return $remsg; } elseif ($result == "-2" || $result == "-1") { $remsg['msg'] = $msg; $remsg['jg'] = '-1'; return $remsg; } else { $remsg['msg'] = $msg; $remsg['jg'] = '-7'; return $remsg; } } else { $remsg['msg'] = '注册成功'; $remsg['jg'] = '1'; $remsg['uid'] = $result; if ($fs == 2) { $ucsynlogin = $windid->synLogin($result); echo $ucsynlogin; } return $remsg; } }
private static function _getWindid() { return WindidApi::api('user'); }
private function _getWindid() { return WindidApi::api('avatar'); }
private function _getWindidUser() { return WindidApi::api('user'); }
/** * 客户端获取服务端配置,服务端禁用 * Enter description here ... * @param unknown_type $name */ public static function C($name) { $windidApi = WindidApi::api('config'); return $windidApi->getConfig($name); }
/** * windid更新 * * @return boolean */ private function _writeWindid() { $baseUrl = Wekit::url()->base; $key = md5(WindUtility::generateRandStr(10)); $charset = Wekit::V('charset'); $charset = str_replace('-', '', strtolower($charset)); if (!in_array($charset, array('gbk', 'utf8', 'big5'))) { $charset = 'utf8'; } $config = new PwConfigSet('windid'); $config->set('windid', 'local')->set('serverUrl', $baseUrl . '/windid')->set('clientId', 1)->set('clientKey', $key)->set('connect', 'db')->flush(); Wekit::C()->reload('windid'); Wind::import('WINDID:service.app.dm.WindidAppDm'); $dm = new WindidAppDm(); $dm->setApiFile('windid.php')->setIsNotify('1')->setIsSyn('1')->setAppName('phpwind9.0')->setSecretkey($key)->setAppUrl($baseUrl)->setCharset($charset)->setAppIp(''); $service = WindidApi::api('app'); $result = $service->addApp($dm); if ($result instanceof WindidError) { $this->showError('INSTALL:windid.init.fail'); } return true; }
<?php session_start(); include "config/handconfig.php"; if (isset($_SESSION['windreg'], $_SESSION['wrsuc'])) { include "fuc/handfuc_a.php"; require_once '/windid_client/src/windid/WindidApi.php'; $windid = WindidApi::api('user'); unset($_SESSION['wrsuc']); $_SESSION['op'] = 'btsnowballsync'; //FOR PHPWIND9.0.1 ONLY $_SESSION['user'] = $_SESSION['windreg']; $ucsynlogin = $windid->synLogin($_SESSION['windreg']); echo $ucsynlogin; ?> <script language="javascript" type="text/javascript"> window.location.href="<?php echo 'http://' . $HWdoamin; ?> "; </script> <?php } else { ?> <script language="javascript" type="text/javascript"> window.location.href="<?php echo 'http://' . $HWdoamin; ?> "; </script> <?php
public static function windid($api) { if (defined('WINDID_IS_NOTIFY')) { $cls[$api] = PwWindidStd::getInstance($api); } else { $cls[$api] = WindidApi::api($api); } return $cls[$api]; }
/** * 获取注册的信息 * * @return PwUserInfoDm */ private function _getUserDm() { list($username, $password, $repassword, $email, $aliww, $qq, $msn, $mobile, $mobileCode, $hometown, $location, $question, $answer, $regreason, $code) = $this->getInput(array('username', 'password', 'repassword', 'email', 'aliww', 'qq', 'msn', 'mobile', 'mobileCode', 'hometown', 'location', 'question', 'answer', 'regreason', 'code'), 'post'); // 验证输入 Wind::import('Wind:utility.WindValidator'); $config = $this->_getRegistConfig(); if (!$username) { $this->showError('USER:user.error.-1', 'u/register/run'); } if (!$password) { $this->showError('USER:pwd.require', 'u/register/run'); } if (!$email) { $this->showError('USER:user.error.-6', 'u/register/run'); } if (!WindValidator::isEmail($email)) { $this->showError('USER:user.error.-7', 'u/register/run'); } foreach ($config['active.field'] as $field) { if (!$this->getInput($field, 'post')) { $this->showError('USER:register.error.require.needField.' . $field, 'u/register/run'); } } if ($config['active.check'] && !$regreason) { $this->showError('USER:register.error.require.regreason', 'u/register/run'); } if ($config['active.phone']) { !PwUserValidator::isMobileValid($mobile) && $this->showError('USER:error.mobile', 'u/register/run'); if (($mobileCheck = Wekit::load('mobile.srv.PwMobileService')->checkVerify($mobile, $mobileCode)) instanceof PwError) { $this->showError($mobileCheck->getError()); } } if ($repassword != $password) { $this->showError('USER:user.error.-20', 'u/register/run'); } if (in_array('register', (array) Wekit::C('verify', 'showverify'))) { $veryfy = Wekit::load("verify.srv.PwCheckVerifyService"); if (false === $veryfy->checkVerify($code)) { $this->showError('USER:verifycode.error', 'u/register/run'); } } Wind::import('SRC:service.user.dm.PwUserInfoDm'); $userDm = new PwUserInfoDm(); $userDm->setUsername($username); $userDm->setPassword($password); $userDm->setEmail($email); $userDm->setRegdate(Pw::getTime()); $userDm->setLastvisit(Pw::getTime()); $userDm->setRegip(Wind::getComponent('request')->getClientIp()); $userDm->setAliww($aliww); $userDm->setQq($qq); $userDm->setMsn($msn); $userDm->setMobile($mobile); $userDm->setMobileCode($mobileCode); $userDm->setQuestion($question, $answer); $userDm->setRegreason($regreason); $areaids = array($hometown, $location); if ($areaids) { $srv = WindidApi::api('area'); $areas = $srv->fetchAreaInfo($areaids); $userDm->setHometown($hometown, isset($areas[$hometown]) ? $areas[$hometown] : ''); $userDm->setLocation($location, isset($areas[$location]) ? $areas[$location] : ''); } return $userDm; }
/** * 获得学校Ds * * @return WindidSchool */ private function _getSchoolDs() { return WindidApi::api('school'); }
/** * 添加用户对象接口,使用前必须使用WidnidApi::getDm('user') 设置数据 * * @param WindidUserDm $dm */ public function addDmUser($dm) { $result = $this->_getUserDs()->addUser($dm); if ($result instanceof WindidError) { return $result->getCode(); } $uid = (int) $result; WindidApi::api('avatar')->defaultAvatar($uid); $this->_getNotifyService()->send('addUser', array('uid' => $uid), WINDID_CLIENT_ID); return $uid; }
public function alterAvatarUrl() { Wekit::C()->setConfig('site', 'avatarUrl', WindidApi::api('avatar')->getAvatarUrl()); return true; }
private function createWindidApi($name) { if (!defined('WEKIT_TIMESTAMP')) { define('WEKIT_TIMESTAMP', time()); } require_once __DIR__ . '/../../../../vendor_user/windid_client/src/windid/WindidApi.php'; return \WindidApi::api($name); }
/** * * @return PwMessageMessages */ private function _getWindid() { return WindidApi::api('message'); }
/** * @return WindidUserBlack */ protected function _getWindidUserBlack() { return WindidApi::api('user'); }