Exemplo n.º 1
0
 /**
  * 初始化安装程序
  */
 public function __construct()
 {
     $this->_appId = 'L000' . time() . WindUtility::generateRandStr(4);
     $this->_config = @(include Wind::getRealPath(self::CONF_PATH, true));
     $this->tmpPath = Wind::getRealPath($this->getConfig('tmp_dir') . '.' . Pw::getTime(), false);
     $this->tmpInstallLog = Wind::getRealPath($this->getConfig('log_dir'), false);
 }
Exemplo n.º 2
0
 /** 
  * 电子邮件用户激活
  */
 public function emailAction()
 {
     list($page, $perpage) = $this->getInput(array('page', 'perpage'));
     $page = $page ? $page : 1;
     $perpage = $perpage ? $perpage : $this->perpage;
     $count = $this->_getDs()->countUnActived();
     $list = array();
     if ($count > 0) {
         $totalPage = ceil($count / $perpage);
         $page > $totalPage && ($page = $totalPage);
         $result = $this->_getDs()->getUnActivedList($perpage, intval(($page - 1) * $perpage));
         /* @var $userDs PwUser */
         $userDs = Wekit::load('user.PwUser');
         $list = $userDs->fetchUserByUid(array_keys($result), PwUser::FETCH_MAIN);
         $list = WindUtility::mergeArray($result, $list);
     }
     $this->setOutput($count, 'count');
     $this->setOutput($page, 'page');
     $this->setOutput($perpage, 'perpage');
     $this->setOutput(array('perpage' => $perpage), 'args');
     $this->setOutput($list, 'list');
     // seo设置
     Wind::import('SRV:seo.bo.PwSeoBo');
     $seoBo = PwSeoBo::getInstance();
     $lang = Wind::getComponent('i18n');
     $seoBo->setCustomSeo($lang->getMessage('SEO:manage.user.email.title'), '', '');
     Wekit::setV('seo', $seoBo);
 }
Exemplo n.º 3
0
 /**
  * 重载了魔术方法__call
  * 
  * 当类的方法访问不到时调用该方法,在这里的实现是配置类属性对象的延迟加载策略
  * <code>
  * //延迟访问某个属性,当使用这种方式调用时该方法被调用,并访问该类中的$_delayAttributes属性,并创建该属性对象并返回
  * $this->_getMethodName(); 
  * </code>
  * @param string $methodName
  * @param array $args
  * @return mixed
  */
 public function __call($methodName, $args)
 {
     $_prefix = substr($methodName, 0, 4);
     $_propertyName = substr($methodName, 4);
     $_propertyName = WindUtility::lcfirst($_propertyName);
     if ($_prefix == '_get') {
         if (!$this->{$_propertyName} && isset($this->_delayAttributes[$_propertyName])) {
             $_property = $this->_delayAttributes[$_propertyName];
             $_value = null;
             if (isset($_property['value'])) {
                 $_value = $_property['value'];
             } elseif (isset($_property['ref'])) {
                 $_value = Wind::getApp()->getWindFactory()->getInstance($_property['ref'], $args);
             } elseif (isset($_property['path'])) {
                 $_className = Wind::import($_property['path']);
                 $_value = WindFactory::createInstance($_className, $args);
             }
             $this->{$_propertyName} = $_value;
             /*unset($this->delayAttributes[$_propertyName]);*/
         }
         return $this->{$_propertyName};
     } elseif ($_prefix == '_set') {
         $this->{$_propertyName} = $args[0];
     }
 }
Exemplo n.º 4
0
 /**
  * 关注-首页
  */
 public function run()
 {
     $type = $this->getInput('type');
     $page = intval($this->getInput('page'));
     $page < 1 && ($page = 1);
     $perpage = 20;
     list($start, $limit) = Pw::page2limit($page, $perpage);
     $url = $classCurrent = array();
     $typeCounts = $this->_getTypeDs()->countUserType($this->loginUser->uid);
     if ($type) {
         $tmp = $this->_getTypeDs()->getUserByType($this->loginUser->uid, $type, $limit, $start);
         $follows = $this->_getDs()->fetchFollows($this->loginUser->uid, array_keys($tmp));
         $count = $typeCounts[$type] ? $typeCounts[$type]['count'] : 0;
         $url['type'] = $type;
         $classCurrent[$type] = 'current';
     } else {
         $follows = $this->_getDs()->getFollows($this->loginUser->uid, $limit, $start);
         $count = $this->loginUser->info['follows'];
         $classCurrent[0] = 'current';
     }
     $uids = array_keys($follows);
     $fans = $this->_getDs()->fetchFans($this->loginUser->uid, $uids);
     $userList = Wekit::load('user.PwUser')->fetchUserByUid($uids, PwUser::FETCH_MAIN | PwUser::FETCH_DATA | PwUser::FETCH_INFO);
     $service = $this->_getService();
     $typeArr = $service->getAllType($this->loginUser->uid);
     $userType = $service->getUserType($this->loginUser->uid, $uids);
     foreach ($userType as $key => $value) {
         $tmp = array();
         foreach ($value as $k => $v) {
             $tmp[$v] = $typeArr[$v];
         }
         ksort($tmp);
         $userType[$key] = $tmp;
     }
     $follows = WindUtility::mergeArray($follows, $userList);
     if (!$type && !$follows) {
         $num = 30;
         $uids = $this->_getRecommendService()->getOnlneUids($num);
         $uids = array_slice($uids, 0, 24);
         $this->setOutput($this->_getRecommendService()->buildUserInfo($this->loginUser->uid, $uids, $num), 'recommend');
     }
     $this->setOutput($follows, 'follows');
     $this->setOutput($typeArr, 'typeArr');
     $this->setOutput($type, 'type');
     $this->setOutput($userType, 'userType');
     $this->setOutput($typeCounts, 'typeCounts');
     $this->setOutput($fans, 'fans');
     $this->setOutput($classCurrent, 'classCurrent');
     $this->setOutput($page, 'page');
     $this->setOutput($perpage, 'perpage');
     $this->setOutput($count, 'count');
     $this->setOutput($url, 'url');
     // seo设置
     Wind::import('SRV:seo.bo.PwSeoBo');
     $seoBo = PwSeoBo::getInstance();
     $lang = Wind::getComponent('i18n');
     $seoBo->setCustomSeo($lang->getMessage('SEO:bbs.follow.run.title'), '', '');
     Wekit::setV('seo', $seoBo);
 }
Exemplo n.º 5
0
 public function getDetailList($notice)
 {
     $list = $uids = array();
     $extendParams = $notice['extend_params'];
     $uids = array_keys($extendParams);
     $userList = Wekit::load('user.PwUser')->fetchUserByUid($uids, PwUser::FETCH_MAIN);
     $list['follows'] = $this->_getAttention()->fetchFollows($notice['uid'], array_keys($userList));
     $list['fans'] = WindUtility::mergeArray(array_unique($extendParams), $userList);
     return $list;
 }
Exemplo n.º 6
0
 /**
  * 运行当前应用
  *
  * @param string $name 应用名称默认‘phpwind’
  * @param array $components 组建配置信息 该组建配置将会覆盖原组建配置,默认为空
  */
 public static function run($name = 'phpwind', $components = array())
 {
     $config = WindUtility::mergeArray(include WEKIT_PATH . '../conf/application/default.php', include WEKIT_PATH . '../conf/application/' . $name . '.php');
     if (!empty($components)) {
         $config['components'] = (array) $components + $config['components'];
     }
     /* @var $application WindWebFrontController */
     $application = Wind::application($name, $config);
     $application->registeFilter(new PwFrontFilters($application));
     $application->run();
 }
Exemplo n.º 7
0
 /**
  * manifest path
  *
  * @param string $manifest        	
  */
 public function __construct($manifest, $extends = array())
 {
     is_string($manifest) && ($manifest = Wind::getComponent('configParser')->parse($manifest));
     if ($extends) {
         $manifest = WindUtility::mergeArray($manifest, $extends);
         $charset = isset($manifest['application']['charset']) ? $manifest['application']['charset'] : 'utf-8';
     } else {
         $charset = Wekit::app()->charset;
     }
     strncasecmp($charset, 'utf', 3) && ($manifest = WindConvert::convert($manifest, $charset, 'utf-8'));
     $this->manifest = $manifest;
 }
 protected function showErrorMessage($message, $file, $line, $trace, $errorcode)
 {
     $log = $message . "\r\n" . $file . ":" . $line . "\r\n";
     list($fileLines, $trace) = WindUtility::crash($file, $line, $trace);
     foreach ($trace as $key => $value) {
         $log .= $value . "\r\n";
     }
     if (WIND_DEBUG & 2) {
         Wind::getApp()->getComponent('windLogger')->error($log, 'error', true);
     }
     exit($log);
 }
 /**
  * 发表帖子 钩子
  */
 public function addThread($tid)
 {
     $data = $this->inputData;
     if (intval($data['isopen'] != 1)) {
         return false;
     }
     $tid = intval($tid);
     if ($tid < 1) {
         return false;
     }
     $token = strtolower(WindUtility::generateRandStr(10));
     $dm = $this->_getEncryptPostsDm();
     $dm->setTid($tid)->setToken($token);
     return $this->_getEncryptPostsDs()->add($dm);
 }
Exemplo n.º 10
0
 /**
  * 关注-首页
  */
 public function run()
 {
     $type = $this->getInput('type');
     $page = intval($this->getInput('page'));
     $page < 1 && ($page = 1);
     $perpage = 20;
     list($start, $limit) = Pw::page2limit($page, $perpage);
     $args = $classCurrent = array();
     /*		$typeCounts = $this->_getTypeDs()->countUserType($this->space->spaceUid);
     		if ($type) {
     			$tmp = $this->_getTypeDs()->getUserByType($this->space->spaceUid, $type, $limit, $start);
     			$follows = $this->_getDs()->fetchFollows($this->space->spaceUid, array_keys($tmp));
     			$count = $typeCounts[$type] ? $typeCounts[$type]['count'] : 0;
     			$classCurrent[$type] = 'current';
     			$args = array('type' => $type);
     		} else {*/
     $follows = $this->_getDs()->getFollows($this->space->spaceUid, $limit, $start);
     $count = $this->space->spaceUser['follows'];
     $classCurrent[0] = 'current';
     //}
     $uids = array_keys($follows);
     $fans = $this->_getDs()->fetchFans($this->loginUser->uid, $uids);
     $myfollows = $this->_getDs()->fetchFollows($this->loginUser->uid, $uids);
     $userList = Wekit::load('user.PwUser')->fetchUserByUid($uids, PwUser::FETCH_ALL);
     $service = $this->_getService();
     $args['uid'] = $this->space->spaceUid;
     $follows = WindUtility::mergeArray($follows, $userList);
     if (!$follows && $this->space->tome == PwSpaceBo::MYSELF) {
         $num = 20;
         $uids = $this->_getRecommendService()->getRecommendAttention($this->loginUser->uid, $num);
         $this->setOutput($this->_getRecommendService()->buildUserInfo($this->loginUser->uid, $uids, $num), 'recommend');
     }
     $this->setOutput($fans, 'fans');
     $this->setOutput($follows, 'follows');
     $this->setOutput($myfollows, 'myfollows');
     $this->setOutput($classCurrent, 'classCurrent');
     $this->setOutput($args, 'args');
     $this->setOutput($page, 'page');
     $this->setOutput($perpage, 'perpage');
     $this->setOutput($count, 'count');
     $this->setOutput('follows', 'src');
     // seo设置
     Wind::import('SRV:seo.bo.PwSeoBo');
     $seoBo = PwSeoBo::getInstance();
     $lang = Wind::getComponent('i18n');
     $seoBo->setCustomSeo($lang->getMessage('SEO:space.follows.run.title', array($this->space->spaceUser['username'], $this->space->space['space_name'])), '', $lang->getMessage('SEO:space.follows.run.description', array($this->space->spaceUser['username'])));
     Wekit::setV('seo', $seoBo);
 }
 public function initConfig($config, $factory)
 {
     is_array($config) || ($config = $factory->getInstance('configParser')->parse($config));
     foreach ($config['web-apps'] as $key => $value) {
         if (isset($this->_config['web-apps'][$key])) {
             continue;
         }
         $rootPath = empty($value['root-path']) ? dirname($_SERVER['SCRIPT_FILENAME']) : Wind::getRealPath($value['root-path'], true);
         Wind::register($rootPath, $key, true);
         if ('default' !== $key && !empty($config['default'])) {
             $value = WindUtility::mergeArray($config['default'], $value);
         }
         $this->setConfig($key, $value);
     }
     $this->_config['router'] = isset($config['router']) ? $config['router'] : array();
 }
Exemplo n.º 12
0
 public function addAction()
 {
     $struct = $this->getInput('struct', 'post');
     $model = $this->getInput('model', 'post');
     $pageid = $this->getInput('pageid', 'post');
     if (!$model) {
         $this->showError('operate.fail');
     }
     Wekit::load('design.PwDesignPermissions');
     $permissions = $this->_getPermissionsService()->getPermissionsForPage($this->loginUser->uid, $pageid);
     if ($permissions < PwDesignPermissions::IS_DESIGN) {
         $this->showError("DESIGN:permissions.fail");
     }
     Wind::import('SRV:design.bo.PwDesignModelBo');
     $bo = new PwDesignModelBo($model);
     if (!$bo->isModel()) {
         $this->showError('operate.fail');
     }
     $cls = sprintf('PwDesign%sDataService', ucwords($model));
     Wind::import('SRV:design.srv.model.' . $model . '.' . $cls);
     $service = new $cls();
     $decorator = $service->decorateAddProperty($model);
     $_models = array();
     $service = $this->_getDesignService();
     $types = $service->getDesignModelType();
     $models = $service->getModelList();
     foreach ($models as $k => $v) {
         $_models[$v['type']][] = array('name' => $v['name'], 'model' => $k);
     }
     $ds = $this->_getModuleDs();
     $pageInfo = $this->_getPageDs()->getPage($pageid);
     $module['module_name'] = $pageInfo['page_name'] . '_' . WindUtility::generateRandStr(4);
     $cache['expired'] = 15;
     $this->setOutput($cache, 'cache');
     $this->setOutput($module, 'module');
     $this->setOutput($types, 'types');
     $this->setOutput($_models, 'models');
     $this->setOutput($bo->getProperty(), 'property');
     $this->setOutput($bo->getModel(), 'modelInfo');
     $this->setOutput($decorator, 'decorator');
     $this->setOutput($model, 'model');
     $this->setOutput($pageid, 'pageid');
     $this->setOutput($struct, 'struct');
 }
Exemplo n.º 13
0
 public function dorunAction()
 {
     $this->getRequest()->isPost() || $this->showError('operate.fail');
     list($windid, $serverUrl, $clientId, $clientKey, $connect) = $this->getInput(array('windid', 'serverUrl', 'clientId', 'clientKey', 'connect'), 'post');
     if ($windid == 'local') {
         $serverUrl = Wekit::C('site', 'info.url') . '/windid';
         $clientId = 1;
         !$clientKey && ($clientKey = md5(WindUtility::generateRandStr(10)));
         $connect = 'db';
     }
     $config = new PwConfigSet('windid');
     $config->set('windid', $windid)->set('serverUrl', $serverUrl)->set('clientId', $clientId)->set('clientKey', $clientKey)->set('connect', $connect);
     if ($windid == 'client') {
         list($dbhost, $dbport, $dbuser, $dbpwd, $dbname, $dbprefix, $dbcharset) = $this->getInput(array('dbhost', 'dbport', 'dbuser', 'dbpwd', 'dbname', 'dbprefix', 'dbcharset'), 'post');
         $config->set('db.host', $dbhost)->set('db.port', $dbport)->set('db.user', $dbuser)->set('db.pwd', $dbpwd)->set('db.name', $dbname)->set('db.prefix', $dbprefix)->set('db.charset', $dbcharset);
     }
     $config->flush();
     if ($clientId) {
         Wekit::C()->reload('windid');
         $service = WindidApi::api('app');
         WindidApi::getDm('app');
         if (!$service->getApp($clientId)) {
             $charset = Wekit::V('charset');
             $charset = str_replace('-', '', strtolower($charset));
             if (!in_array($charset, array('gbk', 'utf8', 'big5'))) {
                 $charset = 'utf8';
             }
             $dm = new WindidAppDm();
             $dm->setId($clientId)->setApiFile('windid.php')->setIsNotify(1)->setIsSyn(1)->setAppName(Wekit::C('site', 'info.name'))->setSecretkey($clientKey)->setAppUrl(Wekit::C('site', 'info.url'))->setAppIp(Wind::getComponent('request')->getClientIp())->setCharset($charset);
             $service->addApp($dm);
         } elseif ($clientKey) {
             $dm = new WindidAppDm($clientId);
             $dm->setSecretkey($clientKey)->setAppUrl(Wekit::C('site', 'info.url'))->setCharset($charset);
             $service->editApp($dm);
         }
     }
     $_avatarUrl = WindidApi::api('avatar')->getAvatarUrl();
     if ($_avatarUrl != WindidError::SERVER_ERROR) {
         Wekit::C()->setConfig('site', 'avatarUrl', $_avatarUrl);
     }
     $this->showMessage('ADMIN:success');
 }
Exemplo n.º 14
0
 public function preHandle()
 {
     if (!$this->form) {
         return null;
     }
     $className = Wind::import($this->form);
     $form = WindFactory::createInstance($className);
     $methods = get_class_methods($form);
     foreach ($methods as $method) {
         if (0 !== strpos($method, 'set') || '' == ($_tmp = substr($method, 3))) {
             continue;
         }
         if (null === ($input = $this->getRequest()->getRequest(WindUtility::lcfirst($_tmp), null))) {
             continue;
         }
         call_user_func_array(array($form, $method), array($input));
     }
     $form->validate();
     $this->getRequest()->setAttribute($form, WindUtility::lcfirst($className));
     $this->sendError($form->getErrorAction(), $form->getErrors());
 }
Exemplo n.º 15
0
 /** 
  * 电子邮件用户激活
  */
 public function emailAction()
 {
     list($page, $perpage) = $this->getInput(array('page', 'perpage'));
     $page = $page ? $page : 1;
     $perpage = $perpage ? $perpage : $this->perpage;
     $count = $this->_getDs()->countUnActived();
     $list = array();
     if ($count > 0) {
         $totalPage = ceil($count / $perpage);
         $page > $totalPage && ($page = $totalPage);
         $result = $this->_getDs()->getUnActivedList($perpage, intval(($page - 1) * $perpage));
         /* @var $userDs PwUser */
         $userDs = Wekit::load('user.PwUser');
         $list = $userDs->fetchUserByUid(array_keys($result), PwUser::FETCH_MAIN);
         $list = WindUtility::mergeArray($result, $list);
     }
     $this->setOutput($count, 'count');
     $this->setOutput($page, 'page');
     $this->setOutput($perpage, 'perpage');
     $this->setOutput($list, 'list');
 }
Exemplo n.º 16
0
 public function run()
 {
     $page = intval($this->getInput('page'));
     $page < 1 && ($page = 1);
     $perpage = 20;
     list($start, $limit) = Pw::page2limit($page, $perpage);
     $count = $this->loginUser->info['fans'];
     $fans = $this->_getDs()->getFans($this->loginUser->uid, $limit, $start);
     $uids = array_keys($fans);
     $follows = $this->_getDs()->fetchFollows($this->loginUser->uid, $uids);
     $userList = Wekit::load('user.PwUser')->fetchUserByUid($uids, PwUser::FETCH_MAIN | PwUser::FETCH_DATA | PwUser::FETCH_INFO);
     $this->setOutput(WindUtility::mergeArray($fans, $userList), 'fans');
     $this->setOutput($follows, 'follows');
     $this->setOutput($page, 'page');
     $this->setOutput($perpage, 'perpage');
     $this->setOutput($count, 'count');
     //$this->setOutput($url, 'url');
     // seo设置
     Wind::import('SRV:seo.bo.PwSeoBo');
     $lang = Wind::getComponent('i18n');
     PwSeoBo::setCustomSeo($lang->getMessage('SEO:bbs.fans.run.title'), '', '');
 }
Exemplo n.º 17
0
 public function run()
 {
     $page = intval($this->getInput('page'));
     $page < 1 && ($page = 1);
     $perpage = 20;
     list($start, $limit) = Pw::page2limit($page, $perpage);
     $fans = $this->_getDs()->getFans($this->space->spaceUid, $limit, $start);
     $uids = array_keys($fans);
     $count = $this->space->spaceUser['fans'];
     $follows = $this->_getDs()->fetchFollows($this->loginUser->uid, $uids);
     $userList = Wekit::load('user.PwUser')->fetchUserByUid($uids, PwUser::FETCH_ALL);
     $this->setOutput(WindUtility::mergeArray($fans, $userList), 'fans');
     $this->setOutput($follows, 'follows');
     $this->setOutput($page, 'page');
     $this->setOutput($perpage, 'perpage');
     $this->setOutput($count, 'count');
     $this->setOutput('fans', 'src');
     // seo设置
     Wind::import('SRV:seo.bo.PwSeoBo');
     $lang = Wind::getComponent('i18n');
     PwSeoBo::setCustomSeo($lang->getMessage('SEO:space.fans.run.title', array($this->space->spaceUser['username'], $this->space->space['space_name'])), '', $lang->getMessage('SEO:space.fans.run.description', array($this->space->spaceUser['username'])));
 }
Exemplo n.º 18
0
 /**
  * 获取搜索用户组根权限配置
  *
  * @param array $config
  * @return multitype:multitype:string  
  */
 public function getPermissionCategoryConfig($config)
 {
     $searchconfig = array('other' => array('sub' => array('tag' => array('name' => '本地搜索', 'items' => array('app_search_open', 'app_search_time_interval')))));
     return WindUtility::mergeArray($config, $searchconfig);
 }
Exemplo n.º 19
0
 /**
  * 获得切分后块编译缓存Key值,Key值为一个50位的随机字符串,当产生重复串时继续查找
  * 
  * @return string
  */
 protected function getCompiledBlockKey()
 {
     $key = WindUtility::generateRandStr(50);
     if (key_exists($key, $this->compiledBlockData)) {
         return $this->getCompiledBlockKey();
     }
     return $key;
 }
Exemplo n.º 20
0
 /**
  * 获取唯一标识符串,标识符串的长度为16个字节,128位.
  * 根据当前时间与sessionID,混合生成一个唯一的串.
  * 
  * @return string GUID串,16个字节
  */
 public static function generateGUID()
 {
     return substr(md5(WindUtility::generateRandStr(8) . microtime()), -16);
 }
Exemplo n.º 21
0
<?php

error_reporting(E_ALL & ~E_NOTICE & ~E_WARNING);
require './src/wekit.php';
/* @var $application WindWebFrontController */
Wind::application('install', WindUtility::mergeArray(include WEKIT_PATH . '../conf/application/default.php', include WEKIT_PATH . '../conf/application/install.php'))->run();
Exemplo n.º 22
0
 /**
  * @see PwUploadAction.getSaveName
  */
 function getSaveName(PwUploadFile $file)
 {
     $prename = substr(md5(Pw::getTime() . $file->id . WindUtility::generateRandStr(8)), 10, 15);
     $filename = $this->forum->fid . "_{$this->user->uid}_{$prename}." . $file->ext;
     return $filename;
 }
Exemplo n.º 23
0
 /**
  * @see PwUploadAction.getSaveName
  */
 public function getSaveName(PwUploadFile $file)
 {
     $prename = substr(md5(Pw::getTime() . WindUtility::generateRandStr(8)), 10, 15);
     $this->filename = $prename . '.' . $file->ext;
     return $this->filename;
 }
Exemplo n.º 24
0
 /**
  * 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;
 }
Exemplo n.º 25
0
 public function setData($data, $key = '', $merge = false)
 {
     if ($key) {
         if ($merge && !empty($this->_data[$key])) {
             $this->_data[$key] = WindUtility::mergeArray((array) $this->_data[$key], (array) $data);
         } else {
             $this->_data[$key] = $data;
         }
     } else {
         if (is_object($data)) {
             $data = get_object_vars($data);
         }
         if (is_array($data)) {
             $this->_data = array_merge($this->_data, $data);
         }
     }
 }
Exemplo n.º 26
0
 public function addAction()
 {
     $rand = WindUtility::generateRandStr(10);
     $this->setOutput(md5($rand), 'rand');
     $this->setOutput('windid.php', 'apifile');
 }
Exemplo n.º 27
0
 /**
  * 设置用户密码
  * 
  * @param string $password 新密码
  * @return PwUserInfoDm
  */
 public function setPassword($password)
 {
     $this->getDm()->setPassword($password);
     $this->_password = $password;
     $this->_data['password'] = md5(WindUtility::generateRandStr(16));
     return $this;
 }
Exemplo n.º 28
0
 /**
  * 加载系统配置
  */
 protected static function _loadSystemConfig($name)
 {
     self::$_sc = WindUtility::mergeArray(include WEKIT_PATH . '../conf/application/default.php', include WEKIT_PATH . '../conf/application/' . $name . '.php');
 }
Exemplo n.º 29
0
 public function validateRules()
 {
     return array(WindUtility::buildValidateRule("username", "isRequired"), WindUtility::buildValidateRule("password", "isRequired"));
 }
Exemplo n.º 30
0
 /**
  * 获得module配置,$name为空时返回当前module配置
  * 
  * @param string $name
  *        module名称 默认为空
  * @param boolean $merge
  *        合并默认值
  * @return array
  * @throws WindActionException
  * @throws WindException
  */
 public function getModules($name = '')
 {
     if ($name === '') {
         $name = $this->handlerAdapter->getModule();
     }
     if ($name === 'pattern') {
         $name = $this->handlerAdapter->getDefaultModule();
     }
     $_module = $this->getConfig('modules', $name, array());
     if (!isset($_module['_verified']) || $_module['_verified'] !== true) {
         if (empty($_module) && !empty($this->_config['modules']['pattern'])) {
             $_module = $this->_config['modules']['pattern'];
         }
         $_flag = empty($_module);
         $_module = WindUtility::mergeArray($this->_config['modules']['default'], $_module);
         $_module_str = implode('#', $_module);
         if (strpos($_module_str, '{') !== false) {
             preg_match_all('/{(\\w+)}/i', $_module_str, $matches);
             if (!empty($matches[1])) {
                 $_replace = array();
                 foreach ($matches[1] as $key => $value) {
                     if ($value === $this->handlerAdapter->getModuleKey()) {
                         $_replace['{' . $value . '}'] = $this->handlerAdapter->getModule();
                     } elseif ($value === $this->handlerAdapter->getControllerKey()) {
                         $_replace['{' . $value . '}'] = $this->handlerAdapter->getController();
                     } elseif ($value === $this->handlerAdapter->getActionKey()) {
                         $_replace['{' . $value . '}'] = $this->handlerAdapter->getAction();
                     } else {
                         $_replace['{' . $value . '}'] = $this->request->getGet($value);
                     }
                 }
                 $_module_str = strtr($_module_str, $_replace);
                 $_module = array_combine(array_keys($_module), explode('#', $_module_str));
             }
         } elseif ($_flag) {
             throw new WindException('Your request was not found on this server.', 404);
         }
         $_module['_verified'] = true;
         $this->_config['modules'][$name] = $_module;
     }
     return $_module;
 }