Esempio n. 1
0
 public function __construct()
 {
     $this->logfile = Wind::getRealPath(Wekit::app()->logFile, true);
     if (!WindFile::isFile($this->logfile)) {
         WindFile::write($this->logfile, "<?php die;?>\n");
     }
 }
Esempio n. 2
0
 public function run()
 {
     $ips = $this->_loadSafeService()->getAllowIps();
     $ips = implode(',', $ips);
     $this->setOutput($ips, 'ips');
     $this->setOutput(Wekit::app()->clientIp, 'clientIp');
 }
Esempio n. 3
0
 public function cut()
 {
     static $isDel = false;
     $outFile = $this->getFileName();
     $outDir = $this->getSaveDir($this->moduleid);
     $cut = new PwCutImage();
     $image = $this->getRealPath($outFile);
     if (!$image) {
         return array('', '', $this->store->get($this->image, 0));
     }
     //返回原图片
     $cut->image = $image;
     $cut->outImage = Wind::getRealDir('PUBLIC:') . PUBLIC_ATTACH . '/' . $outDir . $outFile;
     $cut->cutWidth = $this->thumbW;
     $cut->cutHeight = $this->thumbH;
     $cut->quality = 90;
     $cut->forceThumb = true;
     $cut->forceScale = true;
     if ($cut->cut() !== false) {
         if (!$this->store instanceof PwStorageLocal) {
             $localFile = Wind::getRealDir('PUBLIC:') . PUBLIC_ATTACH . '/' . $outDir . $outFile;
             $this->store->save($localFile, $outDir . $outFile);
             $attachUrl = $this->store->get('', 0);
             WindFile::del(Wind::getRealDir('PUBLIC:') . PUBLIC_ATTACH . '/_tmp/' . $outFile);
             WindFile::del($localFile);
         } else {
             $attachUrl = Wekit::app()->attach . '/';
         }
         return array($outDir, $outFile, $attachUrl);
     }
     return array('', '', $this->store->get($this->image, 0));
     //返回原图片
 }
Esempio n. 4
0
 public function afterAction($handlerAdapter)
 {
     parent::afterAction($handlerAdapter);
     $debug = Wekit::C('site', 'debug') || !Wekit::C('site', 'css.compress');
     Wekit::setGlobal(array('debug' => $debug ? '/dev' : '/build'), 'theme');
     $this->setTheme('site', null);
     /* @var $resource WindLangResource */
     $resource = Wind::getComponent('i18n');
     $_error = $this->getForward()->getVars('message');
     if ($resource !== null) {
         foreach ($_error as $key => $value) {
             if (is_array($value)) {
                 list($value, $var) = $value;
             } else {
                 $var = array();
             }
             $message = $resource->getMessage($value, $var);
             $message && ($_error[$key] = $message);
         }
     }
     $this->getForward()->setVars(array('message' => $_error, '__error' => ''));
     $type = $this->getRequest()->getAcceptTypes();
     // 如果是含有上传的递交,不能采用ajax的方式递交,需要以html的方式递交,并且返回的结果需要是json格式,将以json=1传递过来标志
     $json = $this->getInput('_json');
     $requestJson = $this->getRequest()->getIsAjaxRequest() && strpos(strtolower($type), "application/json") !== false;
     if ($requestJson || $json == 1) {
         $this->getResponse()->setHeader('Content-type', 'application/json; charset=' . Wekit::app()->charset);
         exit(Pw::jsonEncode($this->getForward()->getVars()));
     }
 }
Esempio n. 5
0
 public function run()
 {
     header("Content-type: text/html; charset=" . Wekit::app()->charset);
     //$pwServer['HTTP_USER_AGENT'] = 'Shockwave Flash';
     $swfhash = 1;
     echo Pw::jsonEncode(array('uid' => $this->loginUser->uid, 'a' => 'dorun', 'verify' => $swfhash));
     $this->setTemplate('');
 }
Esempio n. 6
0
 /**
  * 获取当前时间戳
  *
  * @return int
  */
 public function getTime()
 {
     $timestamp = time();
     if (Wekit::app() && ($cvtime = Wekit::C('site', 'time.cv'))) {
         $timestamp += $cvtime * 60;
     }
     return $timestamp;
 }
Esempio n. 7
0
 /**
  * 获取web地址
  *
  * @param string $path 相对存储地址
  * @param int $ifthumb 是否获取缩略图
  * @return string
  */
 public function get($path, $ifthumb)
 {
     $dir = '';
     if ($ifthumb & 2) {
         $dir = 'thumb/mini/';
     } elseif ($ifthumb & 1) {
         $dir = 'thumb/';
     }
     return Wekit::app()->attach . '/' . $dir . $path;
 }
Esempio n. 8
0
 /**
  * 重写下afterAction,不去i18n解析
  * 
  */
 public function afterAction($handlerAdapter)
 {
     $_error = $this->getForward()->getVars('message');
     $this->getForward()->setVars(array('message' => $_error, '__error' => ''));
     $type = $this->getRequest()->getAcceptTypes();
     if ($this->getRequest()->getIsAjaxRequest() && strpos(strtolower($type), "application/json") !== false) {
         $this->getResponse()->setHeader('Content-type', 'application/json; charset=' . Wekit::app()->charset);
         exit(Pw::jsonEncode($this->getForward()->getVars()));
     }
 }
Esempio n. 9
0
 public function txt($charset = 'utf-8')
 {
     $pageInfo = $this->pageInfo;
     $_modules = array();
     //$ids = explode(',', $pageInfo['module_ids']);
     $modules = $this->_getModuleDs()->getByPageid($pageInfo['page_id']);
     $fromCharset = Wekit::app()->charset;
     foreach ($modules as $k => $v) {
         if (!$v['isused']) {
             continue;
         }
         unset($v['isused'], $v['module_id']);
         $v['module_property'] = unserialize($v['module_property']);
         $v['module_cache'] = unserialize($v['module_cache']);
         $v['module_style'] = unserialize($v['module_style']);
         $v['module_title'] = unserialize($v['module_title']);
         $v = $this->_conv($v, $fromCharset, $charset);
         $v['module_property'] = serialize($v['module_property']);
         $v['module_cache'] = serialize($v['module_cache']);
         $v['module_style'] = serialize($v['module_style']);
         $v['module_title'] = serialize($v['module_title']);
         $_modules[$k] = $v;
     }
     $names = explode(',', $pageInfo['struct_names']);
     $structures = $this->_getStructureDs()->fetchStruct($names);
     foreach ($structures as &$v) {
         $v['struct_title'] = unserialize($v['struct_title']);
         $v['struct_style'] = unserialize($v['struct_style']);
         $v = $this->_conv($v, $fromCharset, $charset);
         $v['struct_title'] = serialize($v['struct_title']);
         $v['struct_style'] = serialize($v['struct_style']);
     }
     $txtSegment = array();
     $segments = $this->_getSegmentDs()->getSegmentByPageid($pageInfo['page_id']);
     foreach ($segments as $k => $v) {
         if (!$v['segment_tpl']) {
             continue;
         }
         $txtSegment[$k] = $this->_conv($v['segment_struct'], $fromCharset, $charset);
     }
     $txtPage['module_ids'] = $pageInfo['module_ids'];
     $txtPage['struct_names'] = $pageInfo['struct_names'];
     $_nr = "\n";
     $_time = Pw::getTime();
     $_title = $_nr;
     $_text['page'] = $txtPage;
     $_text['segment'] = $txtSegment;
     $_text['structure'] = $structures;
     $_text['module'] = $_modules;
     $_text = wordwrap(base64_encode(serialize($_text)), 100, $_nr, true);
     $_end = $_nr;
     $filename = $pageInfo['page_name'] ? $pageInfo['page_name'] : $_time;
     $_text = $_title . $_text . $_end;
     return array('content' => $_text, 'filename' => $filename, 'ext' => 'txt');
 }
Esempio n. 10
0
 public function execute()
 {
     $data = array();
     $data['site_version'] = WIND_VERSION;
     $data['site_url'] = PUBLIC_URL ? PUBLIC_URL : $_SERVER['SERVER_NAME'];
     $data = Wekit::config('site');
     $data['site_charset'] = Wekit::app()->charset;
     $data['site_name'] = $data['info.name'];
     $data['site_time'] = time();
     return $data;
 }
Esempio n. 11
0
 public function registerTmpUser($from = 1, $key = '')
 {
     //need to check if registered user exists or not
     if (empty($key) == false) {
         //if has key, then check if this key has user or not
         $tmpFound = $this->getbyKey($from, $key);
         if (empty($tmpFound) == false) {
             //if has user info, then return user's information
             $userid = $tmpFound['userid'];
             return Windid::load('user.WindidUser')->getUserByUid($userid, WindidUser::FETCH_MAIN);
         }
     }
     Wind::import('SRC:service.user.dm.PwUserInfoDm');
     $userDm = new PwUserInfoDm();
     $password = substr(md5(rand() . '123456'), 0, 15);
     //order number: 13 number and 3 random number
     $currentTimeStamp = strtotime("+0 day");
     $prefix = 'tmp';
     if ($from == 1) {
         $prefix = 'web';
     } else {
         if ($from == 2) {
             $prefix = 'app';
         } else {
             if ($from == 3) {
                 $prefix = 'wx';
             }
         }
     }
     $username = $prefix . rand(10, 99) . $currentTimeStamp;
     $userDm->setUsername($username);
     $userDm->setPassword($password);
     $userDm->setRegdate(Pw::getTime());
     $userDm->setLastvisit(Pw::getTime());
     $userDm->setRegip(Wekit::app()->clientIp);
     Wind::import('SRV:user.srv.PwRegisterService');
     Wind::import('APPS:u.service.helper.PwUserHelper');
     Wind::import('SRV:user.validator.PwUserValidator');
     Wind::import('Wind:utility.WindValidator');
     Wind::import('SRV:user.srv.PwLoginService');
     $registerService = new PwRegisterService();
     $registerService->setUserDm($userDm);
     $info = $registerService->register();
     $userService = Wekit::load('user.srv.PwUserService');
     $userService->updateLastLoginData($info['uid'], Wekit::app()->clientIp);
     $userService->createIdentity($info['uid'], $password);
     $dm = new App_Tmpuser_Dm();
     $dm->setUserId($info['uid']);
     $dm->setFrom($from);
     $dm->setKey($key);
     $this->add($dm);
     return $info;
 }
Esempio n. 12
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;
 }
 public function getAuthorizeURL($sessionId)
 {
     $result = $this->checkStatus();
     if ($result !== true) {
         return new PwError($result);
     }
     if (!$sessionId) {
         return new PwError('登录失败,请重试');
     }
     $params = array("service" => "alipay.auth.authorize", "partner" => $this->appKey, "target_service" => $this->target_service, "return_url" => $this->getCallBackUrl('alipay'), "anti_phishing_key" => $this->anti_phishing_key, "exter_invoke_ip" => $this->exter_invoke_ip, "_input_charset" => strtolower(Wekit::app()->charset));
     return $this->alipay_gateway_new . '?' . http_build_query($this->_buildRequestPara($params));
 }
Esempio n. 14
0
 public function __construct()
 {
     $config = Wekit::C('email');
     $this->_config = array('mailOpen' => $config['mailOpen'], 'mailMethod' => $config['mailMethod'], 'host' => $config['mail.host'], 'port' => $config['mail.port'], 'from' => $config['mail.from'], 'auth' => $config['mail.auth'], 'user' => $config['mail.user'], 'password' => $config['mail.password'], 'timeout' => 20);
     //尝试链接超时时间
     $this->_mail = new WindMail();
     $this->_mail->setCharset(Wekit::app()->charset);
     $this->_mail->setDate(date('r', Pw::getTime()));
     $this->_mail->setContentEncode(WindMail::ENCODE_BASE64);
     $this->_mail->setContentType(WindMail::MIME_HTML);
     $this->_mail->setFrom($this->_config['from'], Wekit::C('site', 'info.name'));
 }
Esempio n. 15
0
 public function preHandle()
 {
     /* 模板变量设置 */
     $url = array();
     $app = Wekit::app();
     $url['base'] = $app->baseUrl;
     $url['res'] = $app->res;
     $url['css'] = $app->css;
     $url['images'] = $app->images;
     $url['js'] = $app->js;
     $url['attach'] = $app->attach;
     $url['extres'] = $app->extres;
     Wekit::setGlobal($url, 'url');
 }
Esempio n. 16
0
 /**
  * 获取应用中心门户模版
  * 
  */
 public function getDesignAppStyle($page = 1, $perpage = 10)
 {
     $type = 'portal';
     $ds = Wekit::load('APPS:appcenter.service.PwStyle');
     $addons = Wekit::load('APPS:appcenter.service.srv.PwInstallApplication')->getConfig('style-type');
     $page < 1 && ($page = 1);
     list($start, $limit) = Pw::page2limit($page, $perpage);
     $list = $ds->getStyleListByType($type, $limit, $start);
     foreach ($list as &$v) {
         if ($v['logo'] && strpos($v['logo'], 'http://') === false) {
             $args = array(Wekit::app()->themes, $addons[$type][1], $v['alias'], $v['logo']);
             $v['logo'] = implode('/', $args);
         }
     }
     return $list;
 }
Esempio n. 17
0
 /**
  * 后台首页处理方法
  */
 public function run()
 {
     //TODO 后台默认首页内容扩展支持
     list($groupType) = $this->getInput(array('type'), 'get');
     $groupType or $groupType = 'member';
     $groups = $this->_getGroupDs()->getGroupsByTypeInUpgradeOrder($groupType);
     if ('member' == $groupType) {
         $points = array();
         $last = '';
         foreach ($groups as $gid => $_item) {
             $points[] = $_item['points'];
             $last = $_item['points'];
         }
         $points[] = 999999999;
         $this->setOutput($points, 'points');
     }
     //用户组类型
     $groupTypes = $this->_getGroupDs()->getGroupTypes();
     $typeClasses = array();
     foreach ($groupTypes as $v) {
         $typeClasses[$v] = $groupType == $v ? ' class="current"' : '';
         //TODO
     }
     //level images
     $imageDir = Wind::getRealDir('PUBLIC:res.images.level') . DIRECTORY_SEPARATOR;
     //$imageDir = sprintf('%s/www/res/images/level/',dirname(rtrim(WEKIT_PATH,DIRECTORY_SEPARATOR)));
     $imageUrl = sprintf('%s/level', Wekit::app()->images);
     $imageFiles = array();
     if (is_dir($imageDir)) {
         if (false !== ($dh = opendir($imageDir))) {
             while (($file = readdir($dh)) !== false) {
                 if (filetype($imageDir . $file) == 'dir') {
                     continue;
                 }
                 $imageFiles[] = $file;
             }
             closedir($dh);
         }
     }
     natcasesort($imageFiles);
     $this->setOutput($imageUrl, 'imageUrl');
     $this->setOutput($imageFiles, 'imageFiles');
     $this->setOutput($groupType, 'groupType');
     $this->setOutput($typeClasses, 'typeClasses');
     $this->setOutput($groups, 'groups');
 }
Esempio n. 18
0
 /**
  * 水印预览
  */
 public function viewAction()
 {
     $config = array('mark.limitwidth' => abs(intval($this->getInput('markLimitwidth', 'post'))), 'mark.limitheight' => abs(intval($this->getInput('markLimitheight', 'post'))), 'mark.position' => $this->getInput('markPosition', 'post'), 'mark.gif' => $this->getInput('markGif', 'post'), 'mark.type' => $this->getInput('markType', 'post'), 'mark.text' => $this->getInput('markText', 'post'), 'mark.fontfamily' => $this->getInput('markFontfamily', 'post'), 'mark.fontsize' => $this->getInput('markFontsize', 'post'), 'mark.fontcolor' => $this->getInput('markFontcolor', 'post'), 'mark.quality' => abs(intval($this->getInput('markQuality', 'post'))), 'mark.file' => $this->getInput('markFile', 'post'), 'mark.transparency' => abs(intval($this->getInput('markTransparency', 'post'))), 'mark.quality' => abs(intval($this->getInput('markQuality', 'post'))));
     Wind::import('LIB:image.PwImage');
     Wind::import('LIB:image.PwImageWatermark');
     $image = new PwImage(Wind::getRealDir('REP:demo', false) . '/demo.jpg');
     $watermark = new PwImageWatermark($image);
     $watermark->setPosition($config['mark.position'])->setType($config['mark.type'])->setTransparency($config['mark.transparency'])->setQuality($config['mark.quality'])->setDstfile(Wind::getRealDir('PUBLIC:attachment', false) . '/demo.jpg');
     if ($config['mark.type'] == 1) {
         $watermark->setFile($config['mark.file']);
     } else {
         $watermark->setText($config['mark.text'])->setFontfamily($config['mark.fontfamily'])->setFontsize($config['mark.fontsize'])->setFontcolor($config['mark.fontcolor']);
     }
     $watermark->execute();
     $this->setOutput(Wekit::app()->attach . '/demo.jpg?' . time(), 'data');
     $this->showMessage('ADMIN:success');
 }
Esempio n. 19
0
 protected function forceDownload($string, $filename, $ext = 'txt', $charset = 'utf-8')
 {
     $router = Wind::getComponent('router');
     $filename = WindConvert::convert($filename, 'gbk', Wekit::app()->charset);
     //ie fixed
     $filename .= '.' . $ext;
     //ob_end_clean();
     header('Content-Encoding: none');
     header("Content-type: application/octet-stream");
     header('Content-type: text/html; charset=' . $charset . '');
     header("Accept-Ranges: bytes");
     header("Accept-Length: " . WindString::strlen($string, $charset));
     header("Content-Disposition: attachment; filename=" . $filename);
     echo $string;
     //@flush();
     //@ob_flush();
     exit;
 }
Esempio n. 20
0
 public function zip($charset = 'utf-8')
 {
     Wind::import('LIB:utility.PwZip');
     $zip = new PwZip();
     $files = $this->read($this->dir);
     $fromCharset = Wekit::app()->charset;
     foreach ($files as &$v) {
         $v['filename'] = str_replace($this->dir, '', $v['filename']);
         $ext = strrchr($v['filename'], ".");
         if ($ext != $this->_tplExt) {
             continue;
         }
         //$v['data'] = $this->decompilePw($v['data']);
         $v['data'] = $this->decompileTitle($v['data']);
         //$v['data'] = $this->decompileList($v['data']);
         $v['data'] = $this->decompileTpl($v['data']);
         $v['data'] = $this->decompileStyle($v['data']);
     }
     foreach ($files as $file) {
         if ($file['filename'] == 'module/data.txt') {
             continue;
         }
         if (strtolower($file['filename']) == 'manifest.xml') {
             Wind::import("WIND:parser.WindXmlParser");
             $xml = new WindXmlParser('1.0', $fromCharset);
             $config = $xml->parseXmlStream($file['data'], 0);
             unset($config['module']);
             $file['data'] = $this->xmlFormat($config, $charset);
         } else {
             $ext = strtolower(substr(strrchr($file['filename'], '.'), 1));
             if (in_array($ext, array('css', 'js', 'htm'))) {
                 $file['data'] = WindConvert::convert($file['data'], $charset, $fromCharset);
             }
         }
         $file['filename'] = $this->folder . '/' . $file['filename'];
         if (!$zip->addFile($file['data'], $file['filename'])) {
             return new PwError("DESIGN:zlib.error");
         }
     }
     $txt = $this->doTxt($charset);
     $txtfile = $this->folder . '/module/data.txt';
     $zip->addFile($txt['content'], $txtfile);
     return $zip->getCompressedFile();
 }
Esempio n. 21
0
 protected function forceDownload($string, $filename, $ext = 'txt')
 {
     $router = Wind::getComponent('router');
     $agent = $router->request->getServer('HTTP_USER_AGENT');
     if (preg_match("/MSIE/", $agent)) {
         $filename = urlencode($filename);
     }
     $filename .= '.' . $ext;
     ob_end_clean();
     header('Content-Encoding: none');
     header("Content-type: application/octet-stream");
     header('Content-type: text/html; charset=' . Wekit::app()->charset . '');
     header("Accept-Ranges: bytes");
     header("Accept-Length: " . Pw::strlen($string));
     header("Content-Disposition: attachment; filename=" . $filename);
     echo $string;
     @flush();
     @ob_flush();
     exit;
 }
Esempio n. 22
0
 /**
  * 空间设置
  * @see wekit/wind/web/WindController::run()
  */
 public function run()
 {
     $perpage = 6;
     $page = 1;
     $this->spaceBo = new PwSpaceBo($this->loginUser->uid);
     $list = $this->_getStyleDs()->getAllStyle('space');
     $addons = Wekit::load('APPS:appcenter.service.srv.PwInstallApplication')->getConfig('style-type');
     //个性域名
     $domain_isopen = Wekit::C('domain', 'space.isopen');
     if ($domain_isopen) {
         $spaceroot = Wekit::C('domain', 'space.root');
         $domain = $this->_spaceDomainDs()->getDomainByUid($this->loginUser->uid);
         $this->setOutput($spaceroot, 'spaceroot');
         $this->setOutput($domain ? $domain : '', 'spacedomain');
     }
     $this->setOutput($list, 'list');
     $this->setOutput($perpage, 'perpage');
     $this->setOutput(ceil(count($list) / $perpage), 'totalpage');
     $this->setOutput(Wekit::app()->themes . '/' . $addons['space'][1], 'themeUrl');
     $this->setOutput($this->spaceBo, 'space');
 }
Esempio n. 23
0
 public function doavatarAction()
 {
     $uid = (int) $this->getInput('uid', 'get');
     Wind::import('WINDID:service.upload.action.WindidAvatarUpload');
     Wind::import('WINDID:service.upload.WindidUpload');
     $bhv = new WindidAvatarUpload($uid);
     $upload = new WindidUpload($bhv);
     if (($result = $upload->check()) === true) {
         $result = $upload->execute();
     }
     if ($result !== true) {
         $array = array("isSuccess" => false, "msg" => WindConvert::convert('上传失败', 'utf8', Wekit::app()->charset), "erCode" => "000");
         //$this->showMessage($result->getMessage());
     } else {
         //用户上传头像之后的钩子
         PwSimpleHook::getInstance('update_avatar')->runDo($uid);
         $array = array("isSuccess" => true, "msg" => WindConvert::convert('上传成功', 'utf8', Wekit::app()->charset), "erCode" => "000");
     }
     echo WindJson::encode($array, Windid::client()->clientCharser);
     exit;
 }
Esempio n. 24
0
 /**
  * 附件存储方式设置列表页
  */
 public function storageAction()
 {
     /* @var $attService PwAttacmentService */
     $attService = Wekit::load('LIB:storage.PwStorage');
     $storages = $attService->getStorages();
     $config = Wekit::C()->getValues('attachment');
     $storageType = 'local';
     if (isset($config['storage.type']) && isset($storages[$config['storage.type']])) {
         $storageType = $config['storage.type'];
     }
     $windidStorages = WindidApi::api('avatar')->getStorages();
     $windidStorageType = Wekit::app('windid')->config->attachment->get('storage.type');
     foreach ($windidStorages as $key => $value) {
         if ($value['managelink']) {
             $windidStorages[$key]['managelink'] = str_replace(Wekit::url()->base, Wekit::app('windid')->url->base, WindUrlHelper::createUrl($value['managelink']));
         }
     }
     $this->setOutput($storages, 'storages');
     $this->setOutput($storageType, 'storageType');
     $this->setOutput($windidStorages, 'windidStorages');
     $this->setOutput($windidStorageType, 'windidStorageType');
 }
Esempio n. 25
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);
 }
Esempio n. 26
0
 public function preHandle()
 {
     $module = $this->router->getModule();
     $controller = $this->router->getController();
     $action = $this->router->getAction();
     if (in_array("{$module}/{$controller}/{$action}", array('default/index/login', 'default/index/showVerify'))) {
         return;
     }
     /* @var $userService AdminUserService */
     $userService = Wekit::load('ADMIN:service.srv.AdminUserService');
     /* @var $safeService AdminSafeService */
     $safeService = Wekit::load('ADMIN:service.srv.AdminSafeService');
     /* @var $founderService AdminFounderService */
     $founderService = Wekit::load('ADMIN:service.srv.AdminFounderService');
     /* @var $loginUser AdminUserBo */
     $loginUser = Wekit::getLoginUser();
     if (!$loginUser->isExists() || !$founderService->isFounder($loginUser->getUsername()) && !$safeService->ipLegal(Wekit::app()->clientIp)) {
         if (!$this->getRequest()->getIsAjaxRequest()) {
             $this->forward->forwardAction('default/index/login');
         } else {
             $this->errorMessage->addError('logout', 'state');
             $this->errorMessage->sendError('ADMIN:login.fail.not.login');
         }
     }
     $_unVerifyTable = array('home', 'index', 'find');
     if (!in_array(strtolower($controller), $_unVerifyTable)) {
         if ($controller != 'adminlog') {
             $logService = Wekit::load('ADMIN:service.srv.AdminLogService');
             $logService->log($this->getRequest(), $loginUser->username, $module, $controller, $action);
         }
         $_result = $userService->verifyUserMenuAuth($loginUser, $module, $controller, $action);
         if ($_result instanceof PwError) {
             $this->errorMessage->sendError($_result->getError());
         }
     }
 }
Esempio n. 27
0
 /**
  * 结果分析路由
  */
 public function routeAction()
 {
     $sessionId = Pw::getCookie($this->_getLoginSessionService()->getCookieName());
     $sessionInfo = App_Account_LoginSessionBo::getInstance($sessionId)->getSession();
     $sessionData = $sessionInfo['sessiondata'];
     $refer = $sessionData['httpReferer'] ? $sessionData['httpReferer'] : $this->hostInfo;
     if (!$this->_getAccountTypeService()->checkType($sessionData['type'])) {
         $this->showError('登录类型错误,请重试');
     }
     if (!$sessionId || !$sessionInfo || !$sessionData['data']['user_id'] || !$sessionData['action']) {
         $this->showError('验证失败,请重试');
     }
     $url = $refer ? $refer : $this->hostInfo . Wind::getComponent('request')->getScriptUrl();
     $type_name = $this->_getAccountTypeService()->getTypeName($sessionData['type']);
     $msg_info = '使用' . $type_name . '账号认证通过(窗口将自动关闭)';
     if ($sessionData['action'] == 'bind') {
         //绑定流程
         $result = $this->_getAccountBindService()->bind($this->uid, $sessionData['data']['user_id'], $sessionData['type']);
         if ($result instanceof PwError) {
             $this->showError($result->getError());
         }
     } elseif ($sessionData['data']['isBound'] == 0 && $sessionData['action'] == 'login') {
         $sign = $sessionData['data']['sign'];
         //没有绑定社区账号 注册或者绑定
         $config = Wekit::C()->getValues('register');
         if ($config['type'] == 0) {
             //关闭注册,跳转到绑定设置页面
             $url = WindUrlHelper::createUrl('app/login/run', array('app' => 'account', 'sign' => $sign));
         } else {
             $url = WindUrlHelper::createUrl('app/register/run', array('app' => 'account', 'sign' => $sign));
         }
     } elseif ($sessionData['data']['isBound'] == 1 && $sessionData['action'] == 'login') {
         //进入登录 用户校验
         $uid = intval($sessionData['data']['bbs_uid']);
         Wind::import('SRV:user.bo.PwUserBo');
         $userBo = PwUserBo::getInstance($uid);
         if (!$userBo->isExists()) {
             //用户不存在
             $this->_getAccountBindDs()->deleteByUid($uid);
             $this->showError('绑定用户在站点已删除,请重试');
         }
         $pattern = '/m=u&c=login/i';
         if (preg_match($pattern, $url)) {
             $url = $this->_getCommonService()->getHost();
         }
         $userService = Wekit::load('user.srv.PwUserService');
         $userService->createIdentity($userBo->uid, $userBo->info['password']);
     }
     $this->setOutput($msg_info, 'msg_info');
     $this->setOutput($url, 'jumpurl');
     $this->setOutput(Wekit::app()->charset, 'charset');
     $this->setTemplate('login_notice');
 }
Esempio n. 28
0
<?php

error_reporting(0);
@header("Content-Type:text/html; charset=utf-8");
define('SCR', 'aCloud_index');
define('WIND_DEBUG', 0);
require_once '.././src/wekit.php';
$front = Wind::application('acloud', WEKIT_PATH . 'aCloud/aCloudConfig.php');
// $front->createApplication();
Wekit::createapp('acloud');
$config = (include WEKIT_PATH . '../conf/application/default.php');
Wekit::app()->charset = $config['web-apps']['default']['charset'];
require_once WEKIT_PATH . 'aCloud/aCloud.php';
$router = new ACloudRouter();
$router->run();
 public function proxyAction()
 {
     print_r($this->getProxyIframe(ACloudSysCoreCommon::getGlobal('g_charset', Wekit::app()->charset)));
     exit;
 }
Esempio n. 30
0
 public function getAttachInfo()
 {
     $array = current($this->attachs);
     $path = Wekit::app('windid')->url->attach . '/' . $array['path'];
     //list($path) = geturl($array['attachurl'], 'lf', $array['ifthumb']&1);
     return array('aid' => $array['aid'], 'path' => $path);
 }