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'); } }
public function run() { $id = (int) $this->getInput('id', 'get'); $portal = $this->_getPortalDs()->getPortal($id); if (!$portal) { $this->showError("page.status.404"); } if (!$portal['isopen']) { $permissions = $this->_getPermissionsService()->getPermissionsForUserGroup($this->loginUser->uid); if ($permissions < 1) { $this->showError("page.status.404"); } } $this->setOutput($portal, 'portal'); if ($portal['navigate']) { $this->setOutput($this->headguide($portal['title']), 'headguide'); } if ($portal['template']) { $url = WindUrlHelper::checkUrl(PUBLIC_THEMES . '/portal/local/' . $portal['template'], PUBLIC_URL); $design['url']['css'] = $url . '/css'; $design['url']['images'] = $url . '/images'; $design['url']['js'] = $url . '/js'; Wekit::setGlobal($design, 'design'); $this->setTemplate("THEMES:portal.local." . $portal['template'] . ".template.index"); } else { $this->setTemplate("TPL:special.index_run"); } //$this->getForward()->getWindView()->compileDir = 'DATA:design.default.' . $id; $this->setTheme($portal['template'], 'THEMES:portal.local'); Wind::import('SRV:seo.bo.PwSeoBo'); PwSeoBo::init('area', 'custom', $id); PwSeoBo::set('{pagename}', $portal['title']); }
/** * 重定向请求到新的url地址 * * 重定向请求到新的url地址是通过head方式重新开启一个url访问请求. * @param WindForward $forward * @param AbstractWindRouter $router * @return void */ protected function dispatchWithRedirect($forward, $router) { if (!($_url = $forward->getUrl())) { $_url = $router->assemble($forward->getAction(), $forward->getArgs()); } $_url = WindUrlHelper::checkUrl($_url, true); $this->getResponse()->sendRedirect($_url); }
public function beforeAction($handlerAdapter) { $url['baseUrl'] = 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); Wekit::setGlobal($url, 'url'); $config = Wind::getComponent('configParser')->parse(Wind::getRealPath('APPS:demo.WindManifest.xml', true, true)); Wekit::setGlobal($config['application'], 'c'); }
protected function compileCss($content, $pageBo) { $dir = $pageBo->getTplPath(); $url = WindUrlHelper::checkUrl(PUBLIC_THEMES . '/portal/local/' . $dir, PUBLIC_URL); if (preg_match_all('/\\{@G:design.url.(\\w+)}/isU', $content, $matches)) { foreach ($matches[1] as $k => $v) { if (!$v) { continue; } $replace = $url . '/' . $v; $content = str_replace($matches[0][$k], $replace, $content); } } return $content; }
public function beforeAction($handlerAdapter) { if ('finish' != $handlerAdapter->getAction()) { Wekit::createapp('install'); } //ajax递交编码转换 if ($this->getRequest()->getIsAjaxRequest()) { $toCharset = $this->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; } } $_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(NEXT_VERSION, 'wind_version'); WindFile::isFile($this->_getInstallLockFile()) && $this->showError('INSTALL:have_install_lock'); }
/** * 编辑公告处理 * * @return void */ public function doUpdateAction() { list($aid, $url) = $this->getInput(array('aid', 'url'), 'post'); if ($aid < 1) { $this->showError('operate.fail'); } $dm = new PwAnnounceDm($aid); $url && ($url = WindUrlHelper::checkUrl($url)); $dm->setContent($this->getInput('content', 'post'))->setEndDate($this->getInput('end_date', 'post'))->setStartDate($this->getInput('start_date', 'post'))->setSubject($this->getInput('subject', 'post'))->setTypeid($this->getInput('typeid', 'post'))->setUrl($url)->setUid($this->loginUser->uid)->setVieworder($this->getInput('vieworder', 'post')); if (($result = $this->_getPwAnnounceDs()->updateAnnounce($dm)) instanceof PwError) { $this->showError($result->getError()); } $this->showMessage('operate.success', 'announce/announce/run'); }
/** * 获取全站url信息 * * @return obj */ public function getUrl() { $_consts = Wekit::S('publish'); foreach ($_consts as $const => $value) { if (defined($const)) { continue; } if ($const === 'PUBLIC_URL' && !$value) { $value = Wind::getComponent('request')->getBaseUrl(true); if (defined('BOOT_PATH') && 0 === strpos(BOOT_PATH, PUBLIC_PATH)) { $path = substr(BOOT_PATH, strlen(PUBLIC_PATH)); !empty($path) && ($value = substr($value, 0, -strlen($path))); } } define($const, $value); } $url = new stdClass(); $url->base = PUBLIC_URL; $url->res = WindUrlHelper::checkUrl(PUBLIC_RES, $url->base); $url->css = WindUrlHelper::checkUrl(PUBLIC_RES . '/css/', $url->base); $url->images = WindUrlHelper::checkUrl(PUBLIC_RES . '/images/', $url->base); $url->js = WindUrlHelper::checkUrl(PUBLIC_RES . '/js/dev/', $url->base); $url->attach = WindUrlHelper::checkUrl(PUBLIC_ATTACH, $url->base); $url->themes = WindUrlHelper::checkUrl(PUBLIC_THEMES, $url->base); $url->extres = WindUrlHelper::checkUrl(PUBLIC_THEMES . '/extres/', $url->base); return $url; }
public function getMedalImage($path = '', $filename = '') { if ($path) { return Pw::getPath($path . $filename); } else { return WindUrlHelper::checkUrl(PUBLIC_RES . '/images/medal/', PUBLIC_URL) . '/' . $filename; } /*if ($type == 'image'){ return WindUrlHelper::checkUrl(PUBLIC_RES . '/images/medal/big', PUBLIC_URL); } else { return WindUrlHelper::checkUrl(PUBLIC_RES . '/images/medal/small', PUBLIC_URL); }*/ }
/** * 初始化模板中的各静态路径 */ protected function _initUrl() { $_consts = (include Wind::getRealPath('CONF:publish.php', true)); foreach ($_consts as $const => $value) { if (defined($const)) { continue; } if ($const === 'PUBLIC_URL' && !$value) { $value = Wind::getComponent('request')->getBaseUrl(true); if (defined('BOOT_PATH') && 0 === strpos(BOOT_PATH, PUBLIC_PATH)) { $path = substr(BOOT_PATH, strlen(PUBLIC_PATH)); !empty($path) && ($value = substr($value, 0, -strlen($path))); } } define($const, $value); } $this->baseUrl = PUBLIC_URL; $this->res = WindUrlHelper::checkUrl(PUBLIC_RES, $this->baseUrl); $this->css = WindUrlHelper::checkUrl(PUBLIC_RES . '/css/', $this->baseUrl); $this->images = WindUrlHelper::checkUrl(PUBLIC_RES . '/images/', $this->baseUrl); //$this->js = WindUrlHelper::checkUrl(PUBLIC_RES . '/js/' . (WIND_DEBUG ? 'dev/' : 'build/'), $this->baseUrl); $this->js = WindUrlHelper::checkUrl(PUBLIC_RES . '/js/' . 'dev/', $this->baseUrl); $this->attach = WindUrlHelper::checkUrl(PUBLIC_ATTACH, $this->baseUrl); $this->themes = WindUrlHelper::checkUrl(PUBLIC_THEMES, $this->baseUrl); $this->extres = WindUrlHelper::checkUrl(PUBLIC_THEMES . '/extres/', $this->baseUrl); }
/** * 组装我参与的勋章及自动勋章列表 * * 非cahce:PwUserMedalBo->getMyAndAutoMedal() * Enter description here ... * @param int $uid */ public function getMyAndAutoMedal($uid) { if (!$uid) { return array(); } $_medals = $myMedalIds = $status = array(); $logs = Wekit::load('medal.PwMedalLog')->getInfoListByUid($uid); foreach ($logs as $log) { $myMedalIds[] = $log['medal_id']; $status[$log['medal_id']] = $log['award_status']; } $cacheDs = Wekit::cache(); $autoMedalIds = $cacheDs->get('medal_auto'); $medals = $cacheDs->get('medal_all'); $attachUrl = Pw::getPath('') . 'medal/'; $localUrl = WindUrlHelper::checkUrl(PUBLIC_RES . '/images/medal/', PUBLIC_URL) . '/'; $medalIds = array_merge($myMedalIds, $autoMedalIds); $medalIds = array_unique($medalIds); foreach ($medalIds as $id) { if (!isset($medals[$id])) { continue; } $medals[$id]['award_status'] = isset($status[$id]) ? $status[$id] : 0; $path = $medals[$id]['path'] ? $attachUrl : $localUrl; $_tmp = $medals[$id]; $_tmp['image'] = $path . $_tmp['image']; $_tmp['icon'] = $path . $_tmp['icon']; $_medals[] = $_tmp; } return $_medals; }