public function run() { $array = array(); $url = Wekit::getGlobal('url', 'res') . '/images/emotion/'; $type = $this->getInput('type', 'get'); if (empty($type)) { $type = 'bbs'; } $catList = $this->_getCategoryDs()->getCategoryList($type, 1); !is_array($catList) && ($catList = array()); $categoryIds = array_keys($catList); $list = $this->_getEmotionDs()->fetchEmotionByCatid($categoryIds); foreach ($list as $emotion) { $_emotion['sign'] = '[s:' . ($emotion['emotion_name'] ? $emotion['emotion_name'] : $emotion['emotion_id']) . ']'; $_emotion['url'] = $url . $emotion['emotion_folder'] . '/' . $emotion['emotion_icon']; $_emotion['name'] = $emotion['emotion_name']; $array[$emotion['category_id']]['category'] = $catList[$emotion['category_id']]['category_name']; $array[$emotion['category_id']]['emotion'][] = $_emotion; } foreach ($catList as $k => $v) { if (!$array[$k]) { continue; } $_array[] = $array[$k]; } $this->setOutput($_array, 'data'); $this->showMessage('success'); }
public function readCss() { echo '<style> .floor_info .operate .dongta { background: url("' . Wekit::getGlobal('url', 'extres') . '/dongta/images/dongta.png") no-repeat scroll -4px 2px transparent; margin-right: 9px; padding-left: 16px; } </style>' . "\n"; }
public function getAttachInfo() { $array = current($this->attachs); $path = Wekit::getGlobal('url', 'attach') . '/' . $array['path']; //list($path) = geturl($array['attachurl'], 'lf', $array['ifthumb']&1); return array('aid' => $array['aid'], 'path' => $path); }
public function emotionAction() { $catId = (int) $this->getInput('catid', 'get'); $category = $this->_getEmotionCategoryDs()->getCategory($catId); if (!($folder = $category['emotion_folder'])) { $this->showError('ADMIN:fail'); } $emotionList = $this->_getEmotionDs()->getListByCatid($catId); $folderEmotion = $this->_getEmotionService()->getFolderIconList($folder); foreach ($emotionList as $key => $emotion) { $emotionList[$key]['sign'] = '[s:' . ($emotion['emotion_name'] ? $emotion['emotion_name'] : $emotion['emotion_id']) . ']'; foreach ($folderEmotion as $k => $val) { if ($emotion['emotion_icon'] == $val) { unset($folderEmotion[$k]); } } } $url = Wekit::getGlobal('url', 'res') . '/images/emotion/'; $this->setOutput($emotionList, 'emotionList'); $this->setOutput($folderEmotion, 'folderEmotion'); $this->setOutput($folder, 'folder'); $this->setOutput($catId, 'catid'); $this->setOutput($url, 'iconUrl'); }
/** * 分享到其它平台使用的链接 * * @access public * @return void * @example * <pre> * /index.php?m=native&c=read&a=sharePage&tid=21 * </pre> */ public function sharePageAction() { $tid = intval($this->getInput('tid', 'get')); list($page, $uid, $desc) = $this->getInput(array('page', 'uid', 'desc'), 'get'); $threadDisplay = new PwThreadDisplay($tid, $this->loginUser); $this->runHook('c_read_run', $threadDisplay); if (($result = $threadDisplay->check()) !== true) { $this->showError($result->getError()); } $_cache = Wekit::cache()->fetch(array('level', 'group_right')); $pwforum = $threadDisplay->getForum(); if ($pwforum->foruminfo['password']) { if (!$this->uid) { $this->forwardAction('u/login/run', array('backurl' => WindUrlHelper::createUrl('bbs/cate/run', array('fid' => ${$pwforum}->fid)))); } elseif (Pw::getPwdCode($pwforum->foruminfo['password']) != Pw::getCookie('fp_' . $pwforum->fid)) { $this->forwardAction('bbs/forum/password', array('fid' => $pwforum->fid)); } } Wind::import('SRV:forum.srv.threadDisplay.PwCommonRead'); $dataSource = new PwCommonRead($threadDisplay->thread); //数据分页 $perpage = $pwforum->forumset['readperpage'] ? $pwforum->forumset['readperpage'] : Wekit::C('bbs', 'read.perpage'); $dataSource->setPage($page)->setPerpage($perpage)->setDesc($desc); $threadDisplay->setImgLazy(Wekit::C('bbs', 'read.image_lazy')); $threadDisplay->execute($dataSource); //主题的信息 $threadInfo = $threadDisplay->getThreadInfo(); $threadInfo['content'] = preg_replace('/onload="([^"]+)"/i', '', $threadInfo['content']); $threadInfo['content'] = preg_replace('/onclick="([^"]+)"/i', '', $threadInfo['content']); $threadInfo['content'] = str_replace('style="max-width:700px;"', '', $threadInfo['content']); preg_match_all('/<div class="J_video" data-url="(.+?\\.swf.*?)".*?><\\/div>/i', $threadInfo['content'], $matches); if (isset($matches[0]) && $matches[0]) { $count = count($matches[0]); for ($i = 0; $i < $count; $i++) { $vedio = '<embed src="' . $matches[1][$i] . '" allowFullScreen="true" quality="high" width="240" height="200" align="middle" allowScriptAccess="always" type="application/x-shockwave-flash"></embed><br>'; // echo $vedio."<br>"; $threadInfo['content'] = str_replace($matches[0][$i], $vedio, $threadInfo['content']); } } //帖子内容音频资源 preg_match_all('/<div class="J_audio".*?data-url="(.+?)".*?><\\/div>/i', $threadInfo['content'], $matches); if (isset($matches[0]) && $matches[0]) { $count = count($matches[0]); for ($i = 0; $i < $count; $i++) { $audio = '<br><audio controls="controls" src="' . $matches[1][$i] . '">不支持音乐</audio><br>'; $threadInfo['content'] = str_replace($matches[0][$i], $audio, $threadInfo['content']); } } //帖子数据列表 $threadList = $threadDisplay->getList(); $threadList = array_slice($threadList, 1, 3); foreach ($threadList as $k => $v) { preg_match_all('/<div class="J_video" data-url="(.+?\\.swf.*?)".*?><\\/div>/i', $v['content'], $matches); if (isset($matches[0]) && $matches[0]) { $count = count($matches[0]); for ($i = 0; $i < $count; $i++) { $vedio = '<embed src="' . $matches[1][$i] . '" allowFullScreen="true" quality="high" width="240" height="200" align="middle" allowScriptAccess="always" type="application/x-shockwave-flash"></embed><br>'; // echo $vedio."<br>"; $threadList[$k]['content'] = str_replace($matches[0][$i], $vedio, $v['content']); } } preg_match_all('/<div class="J_audio".*?data-url="(.+?)".*?><\\/div>/i', $v['content'], $matches); if (isset($matches[0]) && $matches[0]) { $count = count($matches[0]); for ($i = 0; $i < $count; $i++) { $audio = '<br><audio controls="controls" src="' . $matches[1][$i] . '">不支持音乐</audio><br>'; $threadList[$k]['content'] = str_replace($matches[0][$i], $audio, $v['content']); } } } //var_dump($threadList);exit; $this->setOutput(Wekit::getGlobal('url', 'res'), 'resPath'); $this->setOutput($threadInfo, 'threadInfo'); $this->setOutput($threadList, 'threadList'); $this->setOutput($threadDisplay, 'threadDisplay'); $this->setOutput(PwCreditBo::getInstance(), 'creditBo'); }
/** * 解析分享 * * @param mixed $link * @param mixed $img * @param mixed $title * @static * @access public * @return void */ public static function createShare($link, $img, $title) { $link = self::escapeUrl(urldecode($link)); if ($img == "") { $img = Wekit::getGlobal('url', 'res') . '/images/editor/link.png'; } else { $img = self::escapeUrl(urldecode($img)); } $html = ' <div class="shareCanvas"> <img src="' . $img . '" align="absmiddle" /> <a href="' . $link . '" target="_blank">' . $title . '</a> </div>'; return self::_pushCode($html); }