Beispiel #1
0
 public function beforeAction($handlerAdapter)
 {
     parent::beforeAction($handlerAdapter);
     $charset = 'utf-8';
     $_windidkey = $this->getInput('windidkey', 'get');
     $_time = (int) $this->getInput('time', 'get');
     $_clientid = (int) $this->getInput('clientid', 'get');
     if (!$_time || !$_clientid) {
         $this->output(WindidError::FAIL);
     }
     $clent = $this->_getAppDs()->getApp($_clientid);
     if (!$clent) {
         $this->output(WindidError::FAIL);
     }
     if (WindidUtility::appKey($clent['id'], $_time, $clent['secretkey']) != $_windidkey) {
         $this->output(WindidError::FAIL);
     }
     $time = Windid::getTime();
     if ($time - $_time > 120) {
         $this->output(WindidError::TIMEOUT);
     }
     $charset = $clent['charset'] == 1 ? 'utf8' : 'gbk';
     $baseUrl = Wind::getApp()->getRequest()->getBaseUrl(true) . '/';
     $config = array('windid' => 'client', 'serverUrl' => $baseUrl, 'clientId' => $clent['id'], 'clientKey' => $clent['secretkey'], 'clientDb' => 'mysql', 'clientCharser' => $charset);
     WindidClientBo::getInstance($config);
 }
 public function beforeAction($handlerAdapter)
 {
     $this->setOutput(NEXT_VERSION, 'wind_version');
     $_consts = (include Wind::getRealPath('CONF:publish.php', true));
     foreach ($_consts as $const => $value) {
         if (defined($const)) {
             continue;
         }
         if ($const === 'PUBLIC_URL' && !$value) {
             $value = Wind::getApp()->getRequest()->getBaseUrl(true);
         }
         define($const, $value);
     }
     $url = array();
     $url['base'] = PUBLIC_URL;
     $url['res'] = WindUrlHelper::checkUrl(PUBLIC_RES, PUBLIC_URL);
     $url['css'] = WindUrlHelper::checkUrl(PUBLIC_RES . '/css/', PUBLIC_URL);
     $url['images'] = WindUrlHelper::checkUrl(PUBLIC_RES . '/images/', PUBLIC_URL);
     $url['js'] = WindUrlHelper::checkUrl(PUBLIC_RES . '/js/dev/', PUBLIC_URL);
     $url['attach'] = WindUrlHelper::checkUrl(PUBLIC_ATTACH, PUBLIC_URL);
     Wekit::setGlobal($url, 'url');
     $this->setOutput('phpwind 8.7 to 9.0', 'wind_version');
     //ajax递交编码转换
     $token = $this->getInput('token', 'get');
     $lockFile = Wind::getRealPath('DATA:setup.setup.lock', true);
     if (file_exists($lockFile) && !$token) {
         $this->showError('升级程序已被锁定, 如需重新运行,请先删除setup.lock');
     }
     $encryptToken = trim(file_get_contents($lockFile));
     if (md5($token) != $encryptToken) {
         $this->showError('升级程序访问异常! 重新安装请先删除setup.lock');
     }
 }
Beispiel #3
0
 public function checkAction()
 {
     require_once Wind::getRealPath('ACLOUD:aCloud');
     ACloudSysCoreCommon::setGlobal('g_siteurl', PUBLIC_URL);
     ACloudSysCoreCommon::setGlobal('g_sitename', 'phpwind');
     ACloudSysCoreCommon::setGlobal('g_charset', Wind::getApp()->getResponse()->getCharset());
     list($this->BenchService, $operate) = array(ACloudSysCoreCommon::loadSystemClass('administor', 'bench.service'), strtolower($this->getInput("operate")));
     return $operate == 'reset' ? $this->reset() : $this->checkEnvironment();
 }
Beispiel #4
0
 protected function init()
 {
     $router = Wind::getComponent('router');
     $this->default_m || ($this->default_m = Wind::getApp()->getConfig('default-module', '', $router->getDefaultModule()));
     if ($this->getConfig('default')) {
         $router->setDefaultModule($this->default_m);
     }
     $this->init = true;
 }
 public function run()
 {
     $this->setOutput("Error message", "errorHeader");
     $this->setOutput($this->error, "errors");
     $errDir = Wind::getApp()->getConfig('errorpage');
     !$errDir && ($errDir = $this->errorDir);
     $this->setTemplatePath($errDir);
     $this->setTemplate('erroraction');
 }
 /**
  * Tests WindFactory->getInstance()
  */
 public function testGetInstance()
 {
     $this->assertTrue(Wind::getApp()->getComponent("forward") instanceof WindForward);
     try {
         Wind::getApp()->getComponent("notExistCom");
     } catch (WindException $e) {
         return;
     }
     $this->fail("GetInstance Test Error");
 }
Beispiel #7
0
 /**
  * url检查
  * 
  * 当$absolute === true且url不包含协议部分时,默认加上当前应用的协议部分.
  * @param string $url 需要检查合法性的url
  * @param boolean $absolute 是否为绝对路径
  * @return string
  */
 public static function checkUrl($url, $absolute = true)
 {
     if ($absolute) {
         $_baseUrl = $absolute === true ? Wind::getApp()->getRequest()->getBaseUrl(true) : $absolute;
         if (strpos($url, '://') === false) {
             $url = trim($_baseUrl, '/') . '/' . trim($url, '/');
         }
     }
     return $url;
 }
Beispiel #8
0
 public function synLogin($uid)
 {
     Wind::import('SRC:service.user.bo.PwUserBo');
     Wind::import('SRC:service.user.srv.PwLoginService');
     $userBo = new PwUserBo($uid);
     $srv = new PwLoginService();
     $ip = Wind::getApp()->getRequest()->getClientIp();
     $srv->welcome($userBo, $ip);
     return true;
 }
 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 compile($key, $content)
 {
     if (!$this->message) {
         return $content;
     }
     $resource = Wind::getApp()->getComponent('i18n');
     $resource !== null && ($this->message = $resource->getMessage($this->message));
     if (!$this->params) {
         return $this->message;
     }
     return '<?php echo WindUtility::strtr("' . $this->message . '", ' . $this->params . ');?>';
 }
    /**
     * 获取验证码
     */
    public function getAction()
    {
        $rand = $this->getInput('rand', 'get');
        $config = Wekit::C('verify');
        $config['type'] = $config['type'] ? $config['type'] : 'image';
        Wind::import('SRV:verify.srv.PwVerifyService');
        $srv = new PwVerifyService('PwVerifyService_getVerifyType');
        if ($rand) {
            $srv->getVerify($config['type']);
            exit;
        }
        $url = WindUrlHelper::createUrl('verify/index/get', array('rand' => Pw::getTime()), '', 'pw');
        $display = $srv->getOutType($config['type']);
        if ($display == 'flash') {
            $html = '<embed align="middle" 
				width="' . $config['width'] . '" 
				height="' . $config['height'] . '" 
				type="application/x-shockwave-flash" 
				allowscriptaccess="sameDomain" 
				menu="false" 
				bgcolor="#ffffff" 
				wmode="transparent" 
				quality="high" 
				src="' . $url . '">';
            if ($config['voice']) {
                $url = WindUrlHelper::createUrl('verify/index/getAudio', array('songVolume' => 100, 'autoStart' => 'false', 'repeatPlay' => 'false', 'showDownload' => 'false', 'rand' => Pw::getTime()), '', 'pw');
                $html .= '<embed height="20" width="25" 
				type="application/x-shockwave-flash" 
				pluginspage="http://www.macromedia.com/go/getflashplayer" 
				quality="high" 
				src="' . Wind::getApp()->getResponse()->getData('G', 'url', 'images') . '/audio.swf?file=' . urlencode($url) . '">';
            }
            $html .= '<a id="J_verify_update_a" href="#" role="button">换一个</a>';
        } elseif ($display == 'image') {
            $html = '<img id="J_verify_update_img" src="' . $url . '" 
				width="' . $config['width'] . '" 
				height="' . $config['height'] . '" >';
            if ($config['voice']) {
                $url = WindUrlHelper::createUrl('verify/index/getAudio', array('songVolume' => 100, 'autoStart' => 'false', 'repeatPlay' => 'false', 'showDownload' => 'false', 'rand' => Pw::getTime()), '', 'pw');
                $html .= '<span title="点击后键入您听到的内容"><embed wmode="transparent" height="20" width="25" 
				type="application/x-shockwave-flash" 
				pluginspage="http://www.macromedia.com/go/getflashplayer" 
				quality="high" 
				src="' . Wind::getApp()->getResponse()->getData('G', 'url', 'images') . '/audio.swf?file=' . urlencode($url) . '"></span>';
            }
            $html .= '<a id="J_verify_update_a" href="#" role="button">换一个</a>';
        } else {
            $html = $srv->getVerify($config['type']);
        }
        $this->setOutput($html, 'html');
        $this->showMessage("operate.success");
    }
 public function testFormFilter()
 {
     $_SERVER['SCRIPT_FILENAME'] = "index.php";
     $_SERVER['SCRIPT_NAME'] = 'index.php';
     $_SERVER['HTTP_HOST'] = 'localhost';
     $_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_FILENAME'] . '?c=long&a=test';
     $_POST['shi'] = 'shi';
     $_POST['long'] = 'long';
     Wind::application('EnableValidata', $this->getConfigData())->run();
     $testForm = Wind::getApp()->getRequest()->getAttribute("testForm");
     $this->assertEquals("shi", $testForm->getShi());
     $this->assertEquals("long", $testForm->getLong());
 }
Beispiel #13
0
 public function synLogin($uid)
 {
     Wind::import('SRC:service.user.bo.PwUserBo');
     Wind::import('SRC:service.user.srv.PwLoginService');
     $userBo = new PwUserBo($uid);
     if ($userBo->isExists() && !Pw::getstatus($userBo->info['status'], PwUser::STATUS_UNACTIVE)) {
         $srv = new PwLoginService();
         $ip = Wind::getApp()->getRequest()->getClientIp();
         $srv->setLoginCookie($userBo, $ip, 1);
     }
     exit;
     //return true;
 }
 /**
  * Tests WindDispatcher->dispatch()
  */
 public function testDispatch()
 {
     $_SERVER['SCRIPT_FILENAME'] = "index.php";
     $_SERVER['SCRIPT_NAME'] = 'index.php';
     $_SERVER['HTTP_HOST'] = 'localhost';
     $_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_FILENAME'] . '?c=long&a=noPrint';
     $front = Wind::application('long', array('web-apps' => array('long' => array('modules' => array('default' => array('controller-path' => 'data', 'controller-suffix' => 'Controller', 'error-handler' => 'TEST:data.ErrorControllerTest'))))))->run();
     $forward = new WindForward();
     $forward->setIsReAction(true);
     $forward->setAction('/long/test');
     ob_start();
     Wind::getApp()->doDispatch($forward);
     $this->assertEquals(ob_get_clean(), 'LongController-test');
 }
 /**
  * 返回Dao类实例
  * 
  * $className接受两种形式呃参数如下
  * <ul>
  * <li>'namespace:path'</li>
  * <li>'className'</li>
  * </ul>
  * 
  * @param string $className Dao名字
  * @return WindDao
  * @throws WindDaoException 如果获取实例错误抛出异常
  */
 public function getDao($className)
 {
     try {
         if (strpos($className, ":") === false) {
             $className = $this->getDaoResource() . '.' . $className;
         }
         Wind::getApp()->getWindFactory()->addClassDefinitions($className, array('path' => $className, 'scope' => 'application'));
         $daoInstance = Wind::getApp()->getWindFactory()->getInstance($className);
         $daoInstance->setDelayAttributes(array('connection' => array('ref' => 'db')));
         return $daoInstance;
     } catch (Exception $exception) {
         throw new WindDaoException('[dao.WindDaoFactory] create dao ' . $className . ' fail.' . $exception->getMessage());
     }
 }
Beispiel #16
0
 /**
  * ajax递交编码转换
  */
 private function _convertCharsetForAjax()
 {
     if (!Wind::getApp()->getRequest()->getIsAjaxRequest()) {
         return;
     }
     $toCharset = Wind::getApp()->getResponse()->getCharset();
     if (strtoupper(substr($toCharset, 0, 2)) != 'UT') {
         $_tmp = array();
         foreach ($_POST as $key => $value) {
             $key = WindConvert::convert($key, $toCharset, 'UTF-8');
             $_tmp[$key] = WindConvert::convert($value, $toCharset, 'UTF-8');
         }
         $_POST = $_tmp;
     }
 }
Beispiel #17
0
 public function build($router, $action, $args = array())
 {
     list($_a, $_c, $_m, $args) = $this->_resolveMca($router, $action, $args);
     if ($_m && $_m !== $router->getDefaultModule()) {
         $args[$router->getModuleKey()] = $_m;
     }
     if ($_c && $_c !== $router->getDefaultController()) {
         $args[$router->getControllerKey()] = $_c;
     }
     if ($_a && $_a !== $router->getDefaultAction()) {
         $args[$router->getActionKey()] = $_a;
     }
     $_url = Wind::getApp()->getRequest()->getScript() . '?' . WindUrlHelper::argsToUrl($args);
     return $_url;
 }
 /**
  * 编译模板并返回编译后模板地址及内容
  * 
  * <pre>
  * <i>$output==true</i>返回编译文件绝对路径地址和内容,不生成编译文件;
  * <i>$output==false</i>返回编译文件绝对路径地址和内容,生成编译文件
  * </pre>
  * 
  * @param string $template 模板名称 必填
  * @param string $suffix 模板后缀 默认为空 
  * @param boolean $readOnly 是否直接输出模板内容,接受两个值true,false 默认值为false
  * @param boolean $forceOutput 是否强制返回模板内容,默认为不强制
  * @return array(compileFile,content) <pre>
  * <i>compileFile</i>模板编译文件绝对地址,
  * <i>content</i>编译后模板输出内容,当<i>$output</i>
  * 为false时将content写入compileFile</pre>
  */
 public function compile($template, $suffix = '', $readOnly = false, $forceOutput = false)
 {
     $templateFile = $this->windView->getViewTemplate($template, $suffix);
     if (!is_file($templateFile)) {
         throw new WindViewException('[component.viewer.WindViewerResolver.compile] ' . $templateFile, WindViewException::VIEW_NOT_EXIST);
     }
     $compileFile = $this->windView->getCompileFile($template);
     if (!$this->checkReCompile($templateFile, $compileFile)) {
         return array($compileFile, $forceOutput ? WindFile::read($compileFile) : '');
     }
     /* @var $_windTemplate WindViewTemplate */
     $_windTemplate = Wind::getApp()->getComponent('template');
     $_output = $_windTemplate->compile($templateFile, $this);
     $readOnly === false && WindFile::write($compileFile, $_output);
     return array($compileFile, $_output);
 }
 public function setStoragesAction()
 {
     $storage = $this->getInput('storage', 'post');
     $attService = Wekit::load('LIB:storage.PwStorage');
     $_r = $attService->setStoragesComponents($storage);
     if ($_r !== true) {
         $this->output(0);
     }
     $config = new PwConfigSet('attachment');
     $config->set('storage.type', $storage)->flush();
     $components = Wekit::C()->get('components')->toArray();
     Wind::getApp()->getFactory()->loadClassDefinitions($components);
     Wekit::C()->setConfig('site', 'avatarUrl', substr(Pw::getPath('1.gpg'), 0, -6));
     $this->_getNotifyService()->send('alterAvatarUrl', array(), $this->appid);
     $this->output(1);
 }
Beispiel #20
0
 public function preHandle()
 {
     /* 模板变量设置 */
     $url = array();
     $var = Wekit::url();
     $url['base'] = $var->base;
     $url['res'] = $var->res;
     $url['css'] = $var->css;
     $url['images'] = $var->images;
     $url['js'] = $var->js;
     $url['attach'] = $var->attach;
     $url['themes'] = $var->themes;
     $url['extres'] = $var->extres;
     Wekit::setGlobal($url, 'url');
     $request = array('m' => $this->router->getModule(), 'c' => $this->router->getController(), 'a' => $this->router->getAction());
     $request['mc'] = $request['m'] . '/' . $request['c'];
     $request['mca'] = $request['mc'] . '/' . $request['a'];
     Wekit::setGlobal($request, 'request');
     Wekit::setV('request', $request);
     $this->_setPreCache($request['m'], $request['mc'], $request['mca']);
     $loginUser = Wekit::getLoginUser();
     $config = Wekit::C('site');
     if ($config['visit.state'] > 0) {
         $service = Wekit::load('site.srv.PwSiteStatusService');
         $resource = $service->siteStatus($loginUser, $config);
         if ($resource instanceof PwError) {
             if (!($config['visit.state'] == 1 && $request['mc'] == 'u/login')) {
                 $this->showError($resource->getError());
             }
         }
     }
     if (!in_array($request['mc'], array('u/login', 'u/register', 'u/findPwd')) && !$loginUser->getPermission('allow_visit')) {
         if ($loginUser->isExists()) {
             $this->showError(array('permission.visit.allow', array('{grouptitle}' => $loginUser->getGroupInfo('name'))));
         } else {
             $this->forwardRedirect(WindUrlHelper::createUrl('u/login/run'));
         }
     }
     if ($config['refreshtime'] > 0 && Wind::getApp()->getRequest()->isGet() && !Wind::getApp()->getRequest()->getIsAjaxRequest()) {
         if (Wekit::V('lastvist')->lastRequestUri == Wekit::V('lastvist')->requestUri && Wekit::V('lastvist')->lastvisit + $config['refreshtime'] > Pw::getTime()) {
             $this->showError('SITE:refresh.fast');
         }
     }
     $this->_setPreHook($request['m'], $request['mc'], $request['mca']);
     $debug = $config['debug'] || !$config['css.compress'];
     Wekit::setGlobal(array('debug' => $debug ? '/dev' : '/build'), 'theme');
 }
Beispiel #21
0
 protected function getInput($key = null, $method = 'post')
 {
     switch (strtolower($method)) {
         case 'get':
             $value = Wind::getApp()->getRequest()->getGet($key);
             break;
         case 'post':
             $value = Wind::getApp()->getRequest()->getPost($key);
             break;
         case 'cookie':
             $value = Wind::getApp()->getRequest()->getCookie($key);
             break;
         default:
             $value = Wind::getApp()->getRequest()->getRequest($key);
     }
     return $value;
 }
 /**
  * 附件存储方式设置列表页
  */
 public function dostroageAction()
 {
     $att_storage = $this->getInput('att_storage', 'post');
     $avatarurl = $this->getInput('avatarurl', 'post');
     $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();
     $components = Wekit::C()->get('components')->toArray();
     Wind::getApp()->getFactory()->loadClassDefinitions($components);
     Wekit::C()->setConfig('site', 'avatarUrl', substr(Pw::getPath('1.gpg'), 0, -6));
     Wekit::load('WSRV:notify.srv.WindidNotifyService')->send('alterAvatarUrl', array());
     $this->showMessage('WINDID:success');
 }
Beispiel #23
0
 public function beforeAction($handlerAdapter)
 {
     $this->_m = $handlerAdapter->getModule();
     $this->_c = $handlerAdapter->getController();
     $this->_a = $handlerAdapter->getAction();
     $this->_mc = $this->_m . '/' . $this->_c;
     $this->_mca = $this->_mc . '/' . $this->_a;
     $this->_setPreCache($this->_m, $this->_mc, $this->_mca);
     $this->loginUser = Wekit::getLoginUser();
     $this->_setPreHook($this->_m, $this->_mc, $this->_mca);
     $config = Wekit::C('site');
     if ($config['visit.state'] > 0) {
         $service = Wekit::load('site.srv.PwSiteStatusService');
         $resource = $service->siteStatus($this->loginUser, $config);
         if ($resource instanceof PwError) {
             if (!($config['visit.state'] == 1 && $this->_mc == 'u/login')) {
                 $this->showError($resource->getError());
             }
         }
     }
     if (!in_array($this->_mc, array('u/login', 'u/register', 'u/findPwd')) && !$this->loginUser->getPermission('allow_visit')) {
         if ($this->loginUser->isExists()) {
             if ($this->_mca != 'u/login/logout') {
                 $this->showError(array('permission.visit.allow', array('{grouptitle}' => $this->loginUser->getGroupInfo('name'))));
             }
         } else {
             $this->forwardAction('u/login/run');
         }
     }
     if ($config['refreshtime'] > 0 && Wind::getApp()->getRequest()->isGet() && !Wind::getApp()->getRequest()->getIsAjaxRequest()) {
         if (Wekit::app()->lastRequestUri == Wekit::app()->requestUri && Wekit::app()->lastvisit + $config['refreshtime'] > Pw::getTime()) {
             $this->showError('SITE:refresh.fast');
         }
     }
     $debug = $config['debug'] || !$config['css.compress'];
     Wekit::setGlobal(array('debug' => $debug ? '/dev' : '/build'), 'theme');
     $this->setTheme('site', null);
 }
Beispiel #24
0
 /**
  * 组件调用接口
  *
  * @param string $name
  * @param string $tpl
  * @param array $args
  * @return void
  */
 public function component($name, $tpl = '', $args = array())
 {
     if (!($_config = $this->getConfig($name))) {
         return;
     }
     if (!empty($_config['service'])) {
         $service = Wekit::load($_config['service']);
         !is_array($args) && ($args = array($args));
         $method = empty($_config['method']) ? 'run' : $_config['method'];
         if (!method_exists($service, $method)) {
             throw new PwException('method.not.exit', array('{parm1}' => 'wekit.engine.component.PwComponent.component', '{parm2}' => $service, '{parm3}' => $method));
         }
         $result = call_user_func_array(array($service, $method), $args);
         $tpl || ($tpl = $_config['template']);
         /* @var $forward WindForward */
         $forward = Wind::getComponent('forward');
         $forward->getWindView()->templateName = $tpl;
         $forward->setVars($result, 'data');
         Wind::getApp()->doDispatch($forward, true);
     } else {
         die('sorry, not yet been realized');
     }
 }
Beispiel #25
0
 public function onResponse()
 {
     if (Wind::getApp()->getRequest()->getIsAjaxRequest()) {
         return;
     }
     $_var = Wind::getApp()->getResponse()->getData('_aCloud_');
     if (!is_array($_var) || in_array($_var['m'], array('design', 'cron', 'windid'))) {
         return;
     }
     require_once Wind::getRealPath('ACLOUD:aCloud');
     $dataMapper = new PwAcloudDataMapper();
     if (null !== ($collect = $this->getCollect($_var['c']))) {
         if (!$collect->isCollect($_var['a'])) {
             return;
         }
         $vars = Wind::getApp()->getResponse()->getData($_var['current']);
         $collect->collect($dataMapper, $vars);
     }
     $dataMapper->setSrc($_var['c']);
     $dataMapper->setUid(Wekit::getLoginUser()->uid);
     $dataMapper->setUsername(Wekit::getLoginUser()->username);
     $dataMapper->setCharset(Wind::getApp()->getResponse()->getCharset());
     Wind::getApp()->getResponse()->setBody(ACloudAppGuiding::getApp($dataMapper), 'acloud');
 }
Beispiel #26
0
 /**
  * 重定向请求到新的action操作
  * 
  * 该种重定向类型,是中断当前的请求执行过程,开启另外的action操作处理.是在一次请求内部进行重定向,
  * 所以之前的一些处理的结果变量,在重定向后是会继续存在,并可通过forward变量进行访问的.也就是不仅仅是过程的重定向,
  * 也是状态的重定向.
  * @param WindForward $forward
  * @param WindRouter $router
  * @param boolean $display
  * @return void
  */
 protected function dispatchWithAction($forward, $router, $display)
 {
     if (!($action = $forward->getAction())) {
         throw new WindException('[web.WindDispatcher.dispatchWithAction] forward fail.', WindException::ERROR_PARAMETER_TYPE_ERROR);
     }
     $this->display = $display;
     list($_a, $_c, $_m, $arg) = WindUrlHelper::resolveAction($action);
     foreach ($arg as $key => $value) {
         $_GET[$key] = $value;
     }
     foreach ($forward->getArgs() as $key => $value) {
         $_POST[$key] = $value;
     }
     $_a && $router->setAction($_a);
     $_c && $router->setController($_c);
     $_m && $router->setModule($_m);
     Wind::getApp()->run();
 }
 /**
  * 从下一行记录中获得下标是$index的值,如果获取失败则返回false
  * 
  * @param int $index 列下标
  * @return string|bool
  */
 public function fetchColumn($index = 0)
 {
     $result = $this->_statement->fetchColumn($index);
     if (WIND_DEBUG & 2) {
         Wind::getApp()->getComponent('windLogger')->info("[component.db.WindResultSet.fetchColumn] \r\n\tResult:" . WindString::varToString($result));
     }
     return $result;
 }
 /**
  * Tests WindWebApplication->setModules()
  * @dataProvider dataForSetModules
  */
 public function testSetModules($name, $config, $replace = false)
 {
     $this->assertNotEquals($this->front->createApplication()->getModules($name), $config);
     Wind::getApp()->setModules($name, $config, $replace);
     $this->assertEquals(Wind::getApp()->getModules($name), $config);
 }
Beispiel #29
0
 /**
  * 万事俱备
  * @param $request WindHttpRequest
  */
 protected function init($build = false, $request = null)
 {
     if (!$this->_init) {
         $router = Wind::getComponent('router');
         $this->default_m || ($this->default_m = Wind::getApp()->getConfig('default-module', '', $router->getDefaultModule()));
         if ($this->getConfig('default')) {
             $router->setDefaultModule($this->default_m);
         }
         $rule = $this->_getRule();
         if (isset($rule['default'])) {
             $this->rewrite_common = true;
             unset($rule['default']);
         }
         $rule && ($this->rewrite_special = true);
         if ($request) {
             $this->origialBase = $this->base = $request->getBaseUrl();
             $this->scheme = $request->getScheme() . '://';
         }
         $this->_init = true;
     }
     if ($build) {
         $this->omit_mca = $this->onlydomain = false;
         $this->dynamicDomain = $this->dynamic = array();
         $this->dynamicHost = '';
         $this->base === null && ($this->base = Wind::getApp()->getRequest()->getBaseUrl());
     }
 }
Beispiel #30
0
 /**
  * @see PwUploadAction.update
  */
 public function update($uploaddb)
 {
     $srv = Wekit::load('attach.PwThreadAttach');
     foreach ($uploaddb as $key => $value) {
         $value['name'] = WindConvert::convert($value['name'], Wind::getApp()->getResponse()->getCharset(), 'utf-8');
         $att = new PwThreadAttachDm();
         $att->setName($value['name']);
         $att->setType($value['type']);
         $att->setSize($value['size']);
         $att->setPath($value['fileuploadurl']);
         $att->setIfthumb($value['ifthumb']);
         $att->setCreatedUser($this->user->uid);
         $att->setCreatedTime(Pw::getTime());
         if ($value['thumb'] && $value['thumb'][0]) {
             $att->setWidth($value['thumb'][0][2]);
             $att->setHeight($value['thumb'][0][3]);
         }
         $att->setApp('thread');
         $aid = $srv->addAttach($att);
         $this->attachs[$aid] = array('aid' => $aid, 'name' => $value['name'], 'type' => $value['type'], 'path' => $value['fileuploadurl'], 'size' => $value['size'], 'descrip' => $value['descrip'], 'ifthumb' => $value['ifthumb']);
     }
     return true;
 }