protected function xmlFormat($moduleId)
 {
     Wind::import('SRV:design.bo.PwDesignModuleBo');
     $bo = new PwDesignModuleBo($moduleId);
     $module = $bo->getModule();
     if ($module['module_type'] != PwDesignModule::TYPE_SCRIPT) {
         exit('fail');
     }
     $data = $bo->getData(true);
     $dom = new DOMDocument('1.0', 'utf-8');
     $root = $dom->createElement('root');
     $dom->appendChild($root);
     foreach ($data as $v) {
         $child = $dom->createElement('data');
         foreach ((array) $v as $_k => $_v) {
             $_v = WindSecurity::escapeHTML($_v);
             $_k = $dom->createElement($_k);
             $_k->appendChild($dom->createTextNode($_v));
             $child->appendChild($_k);
             $root->appendChild($child);
         }
     }
     header('Content-type: application/xml');
     echo $dom->saveXML();
     exit;
 }
Exemple #2
0
 public function upload($localfile, $remotefile, $mode = null)
 {
     if (!in_array($savedir = dirname($remotefile), array('.', '/'))) {
         $this->mkdirs($savedir);
     }
     $remotefile = $this->rootPath . WindSecurity::escapePath($remotefile);
     return $this->conn->put($remotefile, $localfile, NET_SFTP_LOCAL_FILE);
 }
Exemple #3
0
 public function saveToken($tokenName = '')
 {
     if (empty($this->token[$tokenName])) {
         $this->token[$tokenName] = $this->getToken($tokenName);
         if (empty($this->token[$tokenName])) {
             $this->token[$tokenName] = WindSecurity::generateGUID();
             WindCookie::set($tokenName, $this->token[$tokenName], false, null, null, null, false, true);
         }
     }
     return $this->token[$tokenName];
 }
 public function displayContent($content, $useubb, $remindUser = array(), $contentLength = 140)
 {
     $content = WindSecurity::escapeHTML($content);
     if ($useubb) {
         $ubb = new PwUbbCodeConvertThread();
         $ubb->setRemindUser($remindUser);
         $content = PwSimpleUbbCode::convert($content, $contentLength, $ubb);
     } else {
         $content = Pw::substrs($content, $contentLength);
     }
     return $content;
 }
Exemple #5
0
 public function saveToken($tokenName = '')
 {
     if ($this->token === null) {
         /* @var $tokenContainer IWindHttpContainer */
         $tokenContainer = $this->_getTokenContainer();
         $tokenName = $this->getTokenName($tokenName);
         if ($tokenContainer->isRegistered($tokenName)) {
             $_token = $tokenContainer->get($tokenName);
         } else {
             $_token = WindSecurity::generateGUID();
             $tokenContainer->set($tokenName, $_token);
         }
         $this->token = $_token;
     }
     return $this->token;
 }
 private function _getNewReply($pid, $limit)
 {
     $reply = Wekit::load('forum.PwThread')->getPost($pid);
     $total = $reply['replies'];
     Wind::import('LIB:ubb.PwSimpleUbbCode');
     Wind::import('LIB:ubb.config.PwUbbCodeConvertThread');
     $replydb = Wekit::load('forum.PwPostsReply')->getPostByPid($pid, $limit);
     foreach ($replydb as $key => $value) {
         $value['content'] = WindSecurity::escapeHTML($value['content']);
         if ($value['useubb']) {
             $value['content'] = PwSimpleUbbCode::convert($value['content'], 140, new PwUbbCodeConvertThread());
         } else {
             $value['content'] = Pw::substrs($value['content'], 140);
         }
         $replydb[$key] = $value;
     }
     return $replydb;
 }
Exemple #7
0
 public function dataAction()
 {
     $cron = false;
     $_data = array();
     $page = (int) $this->getInput('page', 'get');
     $pageid = (int) $this->getInput('pageid', 'get');
     $moduleid = (int) $this->getInput('moduleid', 'get');
     $start = (int) $this->getInput('start', 'get');
     $start >= 100 && ($start = 100);
     $module = Wekit::load('design.PwDesignModule')->getModule($moduleid);
     $perpage = 20;
     if (!$module) {
         $this->showMessage("operate.fail");
     }
     //返回成功信息
     $time = Pw::getTime();
     Wind::import('SRV:design.bo.PwDesignPageBo');
     $pageBo = new PwDesignPageBo();
     $ds = Wekit::load('design.PwDesignData');
     $vo = Wekit::load('design.srv.vo.PwDesignDataSo');
     $vo->setModuleId($moduleid);
     $vo->setReservation(0);
     $vo->orderbyViewOrder(true);
     $vo->orderbyDataid(true);
     $data = $ds->searchData($vo, $perpage, $start);
     $this->_getLikeContentService();
     foreach ($data as $k => $v) {
         $_data[$k] = unserialize($v['extend_info']);
         $_data[$k]['fromtype'] = $v['from_app'] == 'thread' ? PwLikeContent::THREAD : 0;
         $_data[$k]['fromid'] = $v['from_id'];
         if ($v['end_time'] > 0 && $v['end_time'] < $time) {
             $cron = true;
         }
         foreach ($_data[$k] as $_k => $_v) {
             $_data[$k][$_k] = WindSecurity::escapeHTML($_v);
         }
     }
     if ($cron || count($data) < 1) {
         $pageBo->updateDesignCron(array($moduleid));
     }
     $this->setOutput($_data, 'data');
     $this->showMessage('operate.success');
 }
 protected function _bulidContent($array, &$errcode)
 {
     $errcode = array();
     $array['content'] = str_replace(array("\r", "\n", "\t"), '', $array['content']);
     $array['content'] = WindSecurity::escapeHTML($array['content']);
     if ($array['ifshield']) {
         $array['subject'] = '';
         $array['content'] = '<span style="text-decoration: line-through">此帖已被屏蔽</span>';
     } elseif ($array['useubb']) {
         $ubb = new PwUbbCodeConvertThread();
         $array['reminds'] && $ubb->setRemindUser($array['reminds']);
         $array['pic'] && $ubb->setAttachParser(new PwFreshAttachDisplay($array['pic']));
         $array['content'] = PwSimpleUbbCode::convert($array['content'], 140, $ubb);
         PwSimpleUbbCode::isSubstr() && ($errcode['is_read_all'] = true);
     } elseif (Pw::strlen($array['content']) > 140) {
         $errcode['is_read_all'] = true;
         $array['content'] = Pw::substrs($array['content'], 140);
     }
     return $array;
 }
Exemple #9
0
 public function rename($oldname, $newname)
 {
     if (!in_array($savedir = dirname($newname), array('.', '/'))) {
         $this->mkdirs($savedir);
     }
     $oldname = $this->rootPath . WindSecurity::escapeDir($oldname);
     $this->sendcmd('RNFR', $oldname);
     return $this->sendcmd('RNTO', $newname);
 }
 public function analyse($attach)
 {
     if ($attach['type'] == 'img' && $attach['cost'] == 0) {
         $atype = 'pic';
         $url = Pw::getPath($attach['path']);
         $img = PwUbbCode::createImg(Pw::getPath($attach['path'], $attach['ifthumb'] & 1), $this->imgWidth, $this->imgHeight, $url, $this->imgLazy);
         $attr = '';
         if ($this->imgLazy && ($tmp = $this->_compare($attach['width'], $attach['height'], $this->imgWidth, $this->imgHeight))) {
             $attr .= ' width="' . $tmp[0] . '"';
             $attr .= ' height="' . $tmp[1] . '"';
         }
         $attach['descrip'] && ($attr .= ' alt="' . WindSecurity::escapeHTML($attach['descrip']) . '"');
         $attr && ($img = substr($img, 0, -3) . $attr . ' />');
         $attach += array('url' => $url, 'img' => $img, 'miniUrl' => Pw::getPath($attach['path'], $attach['ifthumb']));
     } else {
         $atype = 'downattach';
         $attach += array('cname' => '', 'ext' => strtolower(substr(strrchr($attach['name'], '.'), 1)));
     }
     return array($atype, $attach);
 }
 public function getTitleHtml()
 {
     $html = '';
     $titles = $this->getTitle();
     $styleSrv = Wekit::load('design.srv.PwDesignStyle');
     foreach ((array) $titles['titles'] as $k => $v) {
         $_tmp = array('title' => WindSecurity::escapeHTML($v['title']), 'link' => $v['link'], 'image' => $v['image'], 'float' => $v['float'], 'margin' => $v['margin'], 'fontsize' => $v['fontsize'], 'fontcolor' => $v['fontcolor'], 'fontbold' => $v['fontbold'], 'fontunderline' => $v['fontunderline'], 'fontitalic' => $v['fontitalic']);
         $style = $styleSrv->buildTitleStyle($_tmp);
         $styleSrv->setStyle($style);
         list($dom, $jstyle) = $styleSrv->getCss();
         $jtitle = $_tmp['image'] ? '<img src="' . $_tmp['image'] . '" title="' . $_tmp['title'] . '">' : $_tmp['title'];
         if ($jtitle) {
             $html .= '<span';
             $html .= $jstyle ? ' style="' . $jstyle . '"' : '';
             $html .= '>';
             $html .= $_tmp['link'] ? '<a href="' . $_tmp['link'] . '">' : '';
             $html .= $jtitle;
             $html .= $_tmp['link'] ? '</a>' : '';
             $html .= '</span>';
         }
     }
     if ($titles['background']) {
         $bg = array('background' => $titles['background']);
         $styleSrv->setStyle($bg);
         list($dom, $background) = $styleSrv->getCss();
     }
     $bgStyle = $background ? '  style="' . $background . '"' : '';
     if ($html) {
         $html = '<h2 class="cc design_tmode_h2"' . $bgStyle . '>' . $html . '</h2>';
     }
     return $html;
 }
Exemple #12
0
 public function upload($sourceFile, $desFile, $mode = 'I')
 {
     $mode = $this->getMode($sourceFile, $mode);
     if (!in_array($savedir = dirname($desFile), array('.', '/'))) {
         $this->mkdirs($savedir);
     }
     $desFile = $this->rootPath . WindSecurity::escapePath($desFile);
     $result = ftp_put($this->getFtp(), $desFile, $sourceFile, $mode);
     if (false === $result) {
         throw new WindFtpException('[ftp.WindFtp.upload] PUT', WindFtpException::COMMAND_FAILED);
     }
     $this->chmod($desFile, 0644);
     return $this->size($desFile);
 }
Exemple #13
0
 /**
  * 获取对话消息列表
  *
  * @param int $uid
  * @param int $from_uid
  * @param int $start
  * @param int $limit
  * @return array
  */
 public function getDialogMessageList($dialogId, $limit, $start)
 {
     // 对话消息分页
     $count = $this->_getWindid()->countMessage($dialogId);
     if (!$count) {
         return array(0, array());
     }
     $_messages = $this->_getWindid()->getMessageList($dialogId, $start, $limit);
     $messages = array();
     foreach ($_messages as $k => $v) {
         $v['content'] = WindSecurity::escapeHTML($v['content']);
         $messages[$k] = $v;
     }
     krsort($messages);
     return array($count, $messages);
 }
Exemple #14
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::V('charset'));
         $vars = $this->getForward()->getVars();
         isset($vars['referer']) && ($vars['referer'] = rawurlencode($vars['referer']));
         foreach ($vars as $key => $value) {
             if ($key == 'html') {
                 continue;
             }
             $vars[$key] = WindSecurity::escapeArrayHTML($value);
         }
         echo Pw::jsonEncode($vars);
         exit;
     }
 }
Exemple #15
0
 /**
  * 本地安装, 分步模式执行应用安装
  */
 public function doInstallAction()
 {
     list($file, $step, $hash) = $this->getInput(array('file', 'step', 'hash'), 'post');
     if (!$file) {
         $this->showError('APPCENTER:install.checkpackage.fail');
     }
     $install = $this->_installService();
     if ($file) {
         $file = Wind::getRealDir($install->getConfig('tmp_dir'), true) . '/' . $file;
         $file = WindSecurity::escapePath($file, true);
         $install->setTmpPath(dirname($file));
         if (!WindFile::isFile($file)) {
             $this->showError('APPCENTER:install.checkpackage.fail');
         }
         $_r = $install->extractPackage($file);
         if (true !== $_r) {
             $this->showError('APPCENTER:install.checkpackage.format.fail');
         }
         $this->addMessage('APPCENTER:install.step.express');
         $_r = $install->initInstall();
         if (true !== $_r) {
             $this->showError('APPCENTER:install.initinstall.fail');
         }
         $this->addMessage('APPCENTER:install.step.init');
         $hash = $install->getHash();
         $this->addMessage('APPCENTER:install.step.install');
     }
     $step || ($step = 0);
     //$_r = $install->doInstall($step, $hash);
     //在360和ie下,写日志有问题,而且多web环境下,多进程安装也是有问题的
     $_r = $install->doInstall('all', $hash);
     if (true === $_r) {
         $install->clear();
         $this->showMessage('APPCENTER:install.success');
     } elseif (is_array($_r)) {
         $this->setOutput(array('step' => $_r[0], 'hash' => $hash), 'data');
         $this->showMessage($_r[1]);
     } else {
         $install->rollback();
         $this->addMessage(array('step' => $step, 'hash' => $hash), 'data');
         $this->showError($_r->getError());
     }
 }
Exemple #16
0
 /**
  * 删除本地文件
  *
  * @param string $filename 文件绝对地址
  * @return bool
  */
 public static function deleteFile($filename)
 {
     return WindFile::del(WindSecurity::escapePath($filename, true));
 }
 /**
  * 阅读更多
  * 
  */
 public function readAction()
 {
     Wind::import('SRV:forum.bo.PwThreadBo');
     $id = (int) $this->getInput('id');
     $fresh = Wekit::load('attention.PwFresh')->getFresh($id);
     if ($fresh['type'] == 1) {
         $thread = new PwThreadBo($fresh['src_id']);
         $array = $thread->info;
         $array['pid'] = 0;
     } else {
         $array = Wekit::load('forum.PwThread')->getPost($fresh['src_id']);
         $thread = new PwThreadBo($array['tid']);
     }
     Wind::import('LIB:ubb.PwUbbCode');
     Wind::import('LIB:ubb.config.PwUbbCodeConvertThread');
     $array['content'] = WindSecurity::escapeHTML($array['content']);
     $array['content'] = str_replace("\n", '<br />', $array['content']);
     $array['useubb'] && ($array['content'] = PwUbbCode::convert($array['content'], new PwUbbCodeConvertThread($thread, $array, $this->loginUser)));
     echo $array['content'];
     $this->setTemplate('');
 }
Exemple #18
0
 /**
  * 生成导航条节点信息
  *
  * @param array $guide 节点信息
  * @return string
  */
 public function bulidGuide($guide)
 {
     if ($guide[1]) {
         return '<em>&gt;</em><a href="' . $guide[1] . '">' . WindSecurity::escapeHTML($guide[0]) . '</a>';
     }
     return '<em>&gt;</em>' . WindSecurity::escapeHTML($guide[0]);
 }
 public function dataAction()
 {
     $page = (int) $this->getInput('page', 'get');
     $start = (int) $this->getInput('start', 'get');
     $start >= 100 && ($start = 100);
     $perpage = 20;
     $_data = array();
     $logLists = $this->_getBuildLikeService()->getFollowLogList($this->loginUser->uid, $start, $perpage);
     $likeLists = $this->_getBuildLikeService()->getLikeList();
     $likeInfos = $this->_getBuildLikeService()->getLikeInfo();
     $replyInfos = $this->_getBuildLikeService()->getLastReplyInfo();
     foreach ($logLists as $k => $logList) {
         if (!isset($likeInfos[$logList['likeid']])) {
             continue;
         }
         $_data[$k]['fromid'] = $likeLists[$logList['likeid']]['fromid'];
         $_data[$k]['fromtype'] = $likeLists[$logList['likeid']]['typeid'];
         $_data[$k]['url'] = $likeInfos[$logList['likeid']]['url'];
         $_data[$k]['image'] = $likeInfos[$logList['likeid']]['image'];
         $_data[$k]['subject'] = WindSecurity::escapeHTML($likeInfos[$logList['likeid']]['subject']);
         $_data[$k]['descrip'] = WindSecurity::escapeHTML(strip_tags($likeInfos[$logList['likeid']]['content']));
         $_data[$k]['uid'] = $likeInfos[$logList['likeid']]['uid'];
         $_data[$k]['username'] = $likeInfos[$logList['likeid']]['username'];
         $_data[$k]['avatar'] = Pw::getAvatar($likeInfos[$logList['likeid']]['uid'], 'small');
         $_data[$k]['space'] = WindUrlHelper::createUrl('space/index/run/?uid=' . $likeInfos[$logList['likeid']]['uid']);
         $_data[$k]['lasttime'] = Pw::time2str($likeInfos[$logList['likeid']]['lasttime'], 'auto');
         $_data[$k]['like_count'] = $likeInfos[$logList['likeid']]['like_count'];
         $_data[$k]['reply_pid'] = $replyInfos[$likeLists[$logList['likeid']]['reply_pid']];
         $_data[$k]['reply_uid'] = $replyInfos[$likeLists[$logList['likeid']]['reply_pid']]['uid'];
         $_data[$k]['reply_avatar'] = Pw::getAvatar($replyInfos[$likeLists[$logList['likeid']]['reply_pid']]['uid'], 'small');
         $_data[$k]['reply_space'] = WindUrlHelper::createUrl('space/index/run/?uid=' . $replyInfos[$likeLists[$logList['likeid']]['reply_pid']]['uid']);
         $_data[$k]['reply_username'] = $replyInfos[$likeLists[$logList['likeid']]['reply_pid']]['username'];
         $_data[$k]['reply_content'] = WindSecurity::escapeHTML($replyInfos[$likeLists[$logList['likeid']]['reply_pid']]['content']);
         $_data[$k]['like_url'] = WindUrlHelper::createUrl('like/mylike/doLike/?typeid=' . $_data[$k]['fromtype'] . '&fromid=' . $_data[$k]['fromid']);
     }
     $this->setOutput($_data, 'data');
     $this->showMessage('operate.success');
 }
 protected function buildThreeArea()
 {
     $fileTmp = WindSecurity::escapePath(Wind::getRealDir('DATA:') . 'tmp/' . 'area.php');
     file_exists($fileTmp) && (self::$_map = (include $fileTmp));
     if (!self::$_map) {
         $area = $this->_getAreaDs()->fetchAll();
         foreach ($area as $key => $value) {
             if ($value['parentid'] < 100) {
                 continue;
             }
             self::$_map[] = $value['areaid'];
         }
         WindFile::savePhpData($fileTmp, self::$_map);
     }
     return self::$_map;
 }
Exemple #21
0
 /**
  * 获得当前编码
  *
  * @return string
  */
 protected function _buildSecurity($content)
 {
     static $charset = '';
     if ($charset) {
         $charset = Wekit::V('charset') == 'GBK' ? 'ISO-8859-1' : Wekit::V('charset');
     }
     return WindSecurity::escapeHTML($content, $charset);
 }
 protected function _bulidContent($content, $ubb, &$errcode)
 {
     $errcode = array();
     $content = str_replace(array("\r", "\n", "\t"), '', $content);
     $content = WindSecurity::escapeHTML($content);
     if ($ubb) {
         $content = PwSimpleUbbCode::convert($content, 140, new PwUbbCodeConvertThread());
         PwSimpleUbbCode::isSubstr() && ($errcode['is_read_all'] = true);
     } elseif (Pw::strlen($content) > 140) {
         $errcode['is_read_all'] = true;
         $content = Pw::substrs($content, 140);
     }
     //var_dump($content);
     //$content = WindSecurity::escapeHTML($content);
     //$content = preg_replace('/(?<!&|&amp;)#([^#]+?)#/ie', "self::_parseTopic('\\1')", $content);
     return $content;
 }
 public function doeditAction()
 {
     $array = array();
     $html = '';
     $title = $this->getInput('title', 'post');
     $link = $this->getInput('link', 'post');
     $image = $this->getInput('image', 'post');
     $float = $this->getInput('float', 'post');
     $margin = $this->getInput('margin', 'post');
     //$position = $this->getInput('position','post');
     //$pixels = $this->getInput('pixels','post');
     $fontsize = $this->getInput('fontsize', 'post');
     $fontcolor = $this->getInput('fontcolor', 'post');
     $fontbold = $this->getInput('fontbold', 'post');
     $fontunderline = $this->getInput('fontunderline', 'post');
     $fontitalic = $this->getInput('fontitalic', 'post');
     $bgimage = $this->getInput('bgimage', 'post');
     $bgcolor = $this->getInput('bgcolor', 'post');
     $bgposition = $this->getInput('bgposition', 'post');
     $styleSrv = $this->_getStyleService();
     $background = array();
     $bgimage && ($background['image'] = $bgimage);
     $bgcolor && ($background['color'] = $bgcolor);
     $bgposition && ($background['position'] = $bgposition);
     //foreach ($pixels AS &$v) $v = (int)$v ? (int)$v: '';
     foreach ($fontsize as &$v) {
         $v = (int) $v ? (int) $v : '';
     }
     foreach ($title as $k => $value) {
         $_tmp = array('title' => $title[$k], 'link' => $link[$k], 'image' => $image[$k], 'float' => $float[$k], 'margin' => $margin[$k], 'fontsize' => $fontsize[$k], 'fontcolor' => $fontcolor[$k], 'fontbold' => $fontbold[$k], 'fontunderline' => $fontunderline[$k], 'fontitalic' => $fontitalic[$k]);
         $style = $this->_buildTitleStyle($_tmp);
         $styleSrv->setStyle($style);
         list($dom, $jstyle) = $styleSrv->getCss($style);
         $jtitle = $image[$k] ? '<img src="' . $_tmp['image'] . '" title="' . WindSecurity::escapeHTML($_tmp['title']) . '">' : WindSecurity::escapeHTML($_tmp['title']);
         if ($jtitle) {
             $html .= '<span ';
             $html .= $jstyle ? 'style="' . $jstyle . '"' : '';
             $html .= '>';
             $html .= $_tmp['link'] ? '<a href="' . $_tmp['link'] . '">' : '';
             $html .= $jtitle;
             $html .= $_tmp['link'] ? '</a>' : '';
             $html .= '</span>';
             $array['titles'][] = $_tmp;
         }
     }
     if ($background) {
         $array['background'] = $background;
         $bg = array('background' => $background);
         $styleSrv->setStyle($bg);
         list($dom, $data['background']) = $styleSrv->getCss();
     }
     $bgStyle = $data['background'] ? '  style="' . $data['background'] . '"' : '';
     if ($html) {
         $html = '<h2 class="cc design_tmode_h2"' . $bgStyle . '>' . $html . '</h2>';
     }
     Wind::import('SRV:design.dm.PwDesignModuleDm');
     $dm = new PwDesignModuleDm($this->bo->moduleid);
     $dm->setTitle($array);
     $resource = $this->_getModuleDs()->updateModule($dm);
     if ($resource instanceof PwError) {
         $this->showError($resource->getError());
     }
     $this->setOutput($html, 'html');
     $this->showMessage("operate.success");
 }
Exemple #24
0
 /**
  * 组装可执行的table
  * 
  * @param array $tables
  * @return tables table1,table2,table3
  */
 private function _buildTables($tables)
 {
     if (!$tables) {
         return false;
     }
     !is_array($tables) && ($tables = array($tables));
     $tables = array_unique($tables);
     $table = '';
     foreach ($tables as $v) {
         $v = WindSecurity::escapeHTML($v);
         $v && ($table .= `{$v}`);
     }
     return $table ? $table : false;
 }
Exemple #25
0
 /**
  * 存储附件,如果是远程存储,记得删除本地文件
  *
  * @param string $source 本地源文件地址
  * @param string $filePath 存储相对位置
  * @return bool
  */
 public function save($source, $filePath)
 {
     $this->_getFtp()->upload($source, $filePath, 'I');
     WindFile::del(WindSecurity::escapePath($source, true));
     return true;
 }
Exemple #26
0
 protected function headguide($protalname)
 {
     $bbsname = Wekit::C('site', 'info.name');
     $headguide = '<a href="' . WindUrlHelper::createUrl('') . '" title="' . $bbsname . '" class="home">首页</a>';
     return $headguide . '<em>&gt;</em>' . WindSecurity::escapeHTML($protalname);
 }
Exemple #27
0
	/**
	 * 将HTML标签转义后输出JSON数据
	 *
	 * @param mixed $data
	 * @return void
	 */
	public static function echoJson($data) {
		echo self::jsonEncode(is_array($data) ? WindSecurity::escapeArrayHTML($data) : WindSecurity::escapeHTML($data));
	}
 /**
  * 级联创建文件夹
  * 
  * @param string $dir 待创建文件夹路径
  * @param string $permissions 创建的文件夹的权限
  * @return boolean 创建成功返回true创建失败返回false
  */
 public function mkdirs($dir, $permissions = 0777)
 {
     $dir = explode('/', WindSecurity::escapePath($dir));
     $dirs = '';
     $result = false;
     $count = count($dir);
     for ($i = 0; $i < $count; $i++) {
         if (strpos($dir[$i], '.') === 0) {
             continue;
         }
         $result = $this->mkdir($dir[$i], $permissions);
         $this->changeDir($this->rootPath . $dirs . $dir[$i]);
         $dirs .= "{$dir[$i]}/";
     }
     $this->changeDir($this->rootPath);
     return $result;
 }
Exemple #29
0
 protected function _bulidBbsSign($sign, $groupRight, $userstatus)
 {
     if (!$groupRight['allow_sign'] || Pw::getstatus($userstatus, PwUser::STATUS_BAN_SIGN)) {
         return '';
     }
     $sign = WindSecurity::escapeHTML($sign);
     if ($groupRight['sign_ubb'] && Pw::getstatus($userstatus, PwUser::STATUS_SIGN_USEUBB)) {
         $ubb = new PwUbbCodeConvertConfig();
         $ubb->isConverImg = $groupRight['sign_ubb_img'] ? true : false;
         $sign = PwUbbCode::convert($sign, $ubb);
     }
     return $sign;
 }
 /**
  * 拖拉模块标题修改
  * Enter description here ...
  */
 public function doedittitleAction()
 {
     $html = '';
     $array = array();
     $pageid = (int) $this->getInput('pageid', 'post');
     $title = $this->getInput('title', 'post');
     if ($pageid < 1) {
         $this->showError("permissions.fail");
     }
     $link = $this->getInput('link', 'post');
     $image = $this->getInput('image', 'post');
     $float = $this->getInput('float', 'post');
     $margin = $this->getInput('margin', 'post');
     $fontsize = $this->getInput('fontsize', 'post');
     $fontcolor = $this->getInput('fontcolor', 'post');
     $fontbold = $this->getInput('fontbold', 'post');
     $fontunderline = $this->getInput('fontunderline', 'post');
     $fontitalic = $this->getInput('fontitalic', 'post');
     $bgimage = $this->getInput('bgimage', 'post');
     $bgcolor = $this->getInput('bgcolor', 'post');
     $bgposition = $this->getInput('bgposition', 'post');
     $structure = $this->getInput('structure', 'post');
     $tab = $this->getInput('tab', 'post');
     $styleSrv = $this->_getStyleService();
     $_n = 0;
     foreach ($tab as $v) {
         if ($v) {
             list($t, $n) = explode('_', $v);
             if ($n >= $_n) {
                 $_n = $n + 1;
             }
         }
     }
     $background['image'] = $bgimage;
     $background['color'] = $bgcolor;
     $background['position'] = $bgposition;
     foreach ($title as $k => $value) {
         $_tmp = array('title' => WindSecurity::escapeHTML($title[$k]), 'link' => $link[$k], 'image' => $image[$k], 'float' => $float[$k], 'margin' => (int) $margin[$k], 'fontsize' => (int) $fontsize[$k], 'fontcolor' => $fontcolor[$k], 'fontbold' => $fontbold[$k], 'fontunderline' => $fontunderline[$k], 'fontitalic' => $fontitalic[$k]);
         $style = $this->_buildTitleStyle($_tmp);
         $styleSrv->setStyle($style);
         list($dom, $jstyle) = $styleSrv->getCss();
         $jtitle = $image[$k] ? '<img src="' . $_tmp['image'] . '" title="' . $_tmp['title'] . '">' : $_tmp['title'];
         if ($jtitle) {
             if ($structure == 'tab') {
                 if (!$tab[$k]) {
                     $tab[$k] = 'tab_' . $_n;
                     $_n++;
                 }
                 $html .= '<li role="tab">';
                 $html .= '<a data-id="' . $tab[$k] . '" href="' . $_tmp['link'] . '"';
                 $html .= $jstyle ? ' style="' . $jstyle . '"' : '';
                 $html .= '>';
                 $html .= $jtitle;
                 $html .= '</a>';
                 $html .= '</li>';
                 $_tmp['tab'] = $tab[$k];
             } else {
                 $html .= '<span';
                 $html .= $jstyle && !$_tmp['link'] ? ' style="' . $jstyle . '"' : '';
                 $html .= '>';
                 $html .= $_tmp['link'] ? '<a href="' . $_tmp['link'] . '" style="' . $jstyle . '">' : '';
                 $html .= $jtitle;
                 $html .= $_tmp['link'] ? '</a>' : '';
                 $html .= '</span>';
             }
             $array['titles'][] = $_tmp;
         }
     }
     $data['tab'] = $html;
     $data['tabName'] = $tab;
     if ($background) {
         $array['background'] = $background;
         $bg = array('background' => $background);
         $styleSrv->setStyle($bg);
         list($dom, $data['background']) = $styleSrv->getCss();
     }
     Wind::import('SRV:design.dm.PwDesignStructureDm');
     $dm = new PwDesignStructureDm();
     $style = $this->bo->getStyle();
     $dm->setStructTitle($array)->setStructname($this->bo->name)->setStructStyle($style['font'], $style['link'], $style['border'], $style['margin'], $style['padding'], $style['background'], $style['styleclass']);
     $resource = $this->_getStructureDs()->replaceStruct($dm);
     if ($resource instanceof PwError) {
         $this->showError($resource->getError());
     }
     $this->setOutput($data, 'data');
     $this->showMessage("operate.success");
 }