private function _getNotifyInfo($uid, $type, $page, $pageSize) { $info = array('count' => 0, 'list' => array(), 'data' => array()); $count = DzHomeNotification::getCountByUid($uid, $type); $notifyData = DzHomeNotification::getAllNotifyByUid($uid, $type, $page, $pageSize); foreach ($notifyData as $data) { $isAllowData = true; $actions = array(); $matches = array(); preg_match('/<a onclick="showWindow.+?>(\\S+)<\\/a>/mi', $data['note'], $matches); if (!empty($matches)) { $actions = array(); $action = array('redirect' => '', 'title' => $matches[1], 'type' => ''); // 添加好友按钮 $tempMatches = array(); preg_match('/ac=friend&op=(\\w+)&uid=(\\d+)/mi', $matches[0], $tempMatches); if (!empty($tempMatches)) { $action['redirect'] = WebUtils::createUrl_oldVersion('user/useradminview', array('act' => $tempMatches[1], 'uid' => $tempMatches[2])); $action['type'] = self::NOTIFY_TYPE_FRIEND; } $data['note'] = str_replace($matches[1], '', $data['note']); // 暂时屏蔽已经是好友的动作 if (friend_check($tempMatches[2])) { $isAllowData = false; $count--; } $actions[] = $action; } if ($isAllowData) { $tmpData['dateline'] = $data['dateline'] . '000'; $tmpData['type'] = $data['type']; $tmpData['note'] = WebUtils::emptyHtml($data['note']); $tmpData['fromId'] = (int) $data['from_id']; $tmpData['fromIdType'] = $data['from_idtype']; $tmpData['author'] = $data['author']; $tmpData['authorId'] = (int) $data['authorid']; $tmpData['authorAvatar'] = UserUtils::getUserAvatar($data['authorid']); $tmpData['actions'] = $actions; $info['data'][] = $tmpData; } } if ($type == self::NOTIFY_TYPE_POST || $type == self::NOTIFY_TYPE_AT) { foreach ($notifyData as $data) { $matches = array(); preg_match_all('/&ptid=(\\d+?)&pid=(\\d+?)"/i', $data['note'], $matches); $ptid = $matches[1][0]; $pid = $matches[2][0]; $postInfo = $this->_getPostInfo($ptid, $pid); if (!empty($postInfo)) { $info['list'][] = $postInfo; } else { --$count; } } } $info['count'] = $count; return $info; }
public function run($tid, $act = 'apply') { $data = TopicUtils::getActivityInfo($tid); $data = $data['action']['info']; $errorMsg = ''; if (!empty($_POST)) { // discuz 源码会在mobile情况下把POST的数据转码成对应的charset, // 由于这里需要强制使用utf-8,且dz本身并没有修改$_REQUEST变量 $_POST = array_intersect_key($_REQUEST, $_POST); $requestData = WebUtils::jsonEncode($_POST, 'utf-8'); $res = WebUtils::httpRequestAppAPI('forum/topicactivity', array('tid' => $tid, 'act' => $act, 'json' => rawurlencode($requestData))); if (($res = WebUtils::jsonDecode($res)) != false && $res['head']['errCode'] == MOBCENT_ERROR_NONE) { $this->getController()->redirect(WebUtils::createUrl_oldVersion('index/returnmobileview')); } if ($res != false) { $errorMsg = $res['head']['errInfo']; } } // render $viewFile = 'topicActivity'; $this->getController()->renderPartial($viewFile, array('data' => $data, 'errorMsg' => $errorMsg, 'formUrl' => WebUtils::createUrl_oldVersion('forum/topicactivityview', array('tid' => $tid, 'act' => $act)))); }
public static function httpRequestAppAPI($route, $params = array(), $timeout = 20) { $url = WebUtils::createUrl_oldVersion($route, $params); return WebUtils::httpRequest($url, $timeout); }
public static function topicRateList($pid, $column = 2, $row = 3) { global $_G; $postlist = $postcache = array(); // 2.5是引用传值,3.1是直接返回。 // $ratelogs = C::t('forum_ratelog')->fetch_postrate_by_pid(array($pid), $postlist, $postcache, $_G['setting']['ratelogrecord']); list($ratelogs, $postlist, $postcache) = self::fetch_postrate_by_pid(array($pid), $postlist, $postcache, $_G['setting']['ratelogrecord']); if (empty($postlist)) { return array('padding' => ''); } // 评分人数和评分栏目的控制 $totalRate = count($postlist[$pid]['totalrate']); $rateItem = $postlist[$pid]['ratelogextcredits']; ksort($rateItem); $i = 1; $t["field{$i}"] = WebUtils::t('参与人数'); $i++; $rateItem = array_slice($rateItem, 0, $column, true); foreach ($rateItem as $id => $score) { $t["field{$i}"] = (string) $_G['setting']['extcredits'][$id]['title']; $i++; } if ($i == 3) { $t['field3'] = ''; $i++; } // $t["field$i"] = (string)WebUtils::t('理由'); // 评分具体内容 $rate = array(); $postlist[$pid]['ratelog'] = array_slice($postlist[$pid]['ratelog'], 0, $row, true); foreach ($postlist[$pid]['ratelog'] as $uid => $ratelog) { $i = 1; $temp["field{$i}"] = (string) $ratelog['username']; $i++; foreach ($rateItem as $id => $score) { $temp["field{$i}"] = isset($ratelog['score'][$id]) ? $ratelog['score'][$id] < 0 ? (string) $ratelog['score'][$id] : '+' . $ratelog['score'][$id] : ''; $i++; } if ($i == 3) { $temp['field3'] = ''; $i++; } // $temp["field$i"] = (string)$ratelog['reason']; $rate[] = $temp; } // 评分总数 $i = 1; $total = array(); $total["field{$i}"] = (string) $totalRate; $i++; foreach ($rateItem as $id => $score) { $total["field{$i}"] = (string) $score; $i++; } if ($i == 3) { $total['field3'] = ''; $i++; } // $total["field$i"] = ''; $tabList = array(); $tabList['head'] = $t; $tabList['total'] = $total; $tabList['body'] = $rate; $tabList['showAllUrl'] = WebUtils::createUrl_oldVersion('forum/ratelistview', array('tid' => $tid, 'pid' => $pid)); return $tabList; }
private function _exitWithHtmlAlert($message) { $message = lang('message', $message); $location = WebUtils::createUrl_oldVersion('index/returnmobileview'); $htmlString = sprintf(' <script> alert("%s"); location.href = "%s"; </script>', $message, $location); echo $htmlString; exit; }
private function _getPostInfos($res, $topic, $page, $pageSize, $order, $authorId, $params = array()) { extract($params); $postInfos = array(); $tid = (int) $topic['tid']; $postCount = ForumUtils::getPostCount($tid, array('authorId' => $authorId)); if (!empty($topic)) { global $_G; $isOnlyAuthorTopic = ForumUtils::isOnlyAuthorTopic($topic); $postList = ForumUtils::getPostList($tid, $page, $pageSize, array('order' => $order ? 'dateline DESC' : 'dateline ASC', 'authorId' => $authorId)); $position = $order ? $postCount + 1 - $pageSize * ($page - 1) : $pageSize * ($page - 1) + 2; if (MobcentDiscuz::getMobcentDiscuzVersion() > 'x25' && $_G['setting']['repliesrank'] && $postList) { if ($postList) { $tempPids = array(); $tempPostRecommends = array(); foreach ($postList as $post) { $tempPids[] = (int) $post['pid']; } foreach (C::t('forum_hotreply_number')->fetch_all_by_pids(array_values($tempPids)) as $pid => $post) { $tempPostRecommends[$pid]['support'] = dintval($post['support']); // $tempPostRecommends[$pid]['against'] = dintval($post['against']); } $isSupport = DzSupportInfo::getSupportPostsByUidAndTid($_G['uid'], $tid); } } foreach ($postList as $post) { $pid = (int) $post['pid']; $content = ForumUtils::getPostContent($tid, $pid, $post); $isOnlyAuthorPost = $isOnlyAuthorTopic && $_G['uid'] != $post['authorid'] && $_G['uid'] != $_G['forum_thread']['authorid'] && !$post['first'] && !$_G['forum']['ismoderator']; $postInfo['reply_id'] = ForumUtils::isAnonymousPost($tid, $post) ? 0 : (int) $post['authorid']; $postInfo['reply_content'] = $isOnlyAuthorPost ? $this->_filterContent(array(array('content' => WebUtils::t('此帖仅作者可见'), 'type' => 'text'))) : $this->_getPostContent($content); $postInfo['reply_type'] = 'normal'; $this->_isComplexContent($postInfo['reply_content']) && ($postInfo['reply_type'] = 'normal_complex'); $postInfo['reply_name'] = ForumUtils::isAnonymousPost($tid, $post) ? $this->_getAnonymoustext() : $post['author']; $postInfo['reply_posts_id'] = $pid; // 抢楼帖时采用原楼层 if (getstatus($topic['status'], 3)) { $postInfo['position'] = $post['position']; } else { $postInfo['position'] = $order ? $position-- : $position++; } $postInfo['posts_date'] = $post['dateline'] . '000'; $postInfo['icon'] = UserUtils::getUserAvatar($postInfo['reply_id']); $postInfo['level'] = $this->_getUserLevel($postInfo['reply_id']); $postInfo['userTitle'] = UserUtils::getUserTitle($postInfo['reply_id']); $postInfo['location'] = ForumUtils::getPostLocation($pid); $postInfo['mobileSign'] = ForumUtils::getMobileSign($post['status']); // if(empty($post['author']) && isset($post['authorid']) && !empty($post['authorid'])){ // $postInfo['reply_status'] = -1; // }elseif(empty($post ['author']) && empty($post ['authorid'])){ // $postInfo['reply_status'] = 0; // }else{ // $postInfo['reply_status'] = 1; // } $postInfo['reply_status'] = 1; $postInfo['status'] = 1; $postInfo['role_num'] = 1; $postInfo['title'] = ''; $postInfo = array_merge($postInfo, $this->_getPostQuoteInfo($content, $isOnlyAuthorPost)); // 回帖管理面板编辑 start $userMember = $this->_getUserInfoByAuthorid($post['authorid']); $userMember = array_merge($userMember, $post); $params = array('editPerm' => $editPerm, 'userMember' => $userMember); // end $manageItems = ForumUtils::getPostManagePanel($params); foreach ($manageItems['post'] as $key => $item) { if ($item['action'] == 'edit') { $item['action'] = WebUtils::getHttpFileName("forum.php?mod=post&action=edit&fid={$post['fid']}&tid={$post['tid']}&pid={$post['pid']}"); } else { $item['action'] = WebUtils::createUrl_oldVersion('forum/topicadminview', array('fid' => $post['fid'], 'tid' => $tid, 'pid' => $post['pid'], 'act' => $item['action'], 'type' => 'post')); } $manageItems['post'][$key] = $item; } $count = mb_strlen($postInfo['reply_content'][0]['infor'], $_G['charset']); if ($count < $_G['setting']['threadfilternum']) { $isWater = true; } $isWater = false; $count = mb_strlen($postInfo['reply_content'][0]['infor'], $_G['charset']); if ($_G['setting']['filterednovote'] && $count < $_G['setting']['threadfilternum']) { $isWater = true; } $extraItems = array(); $tempExtraItems = ForumUtils::getPostExtraPanel(); foreach ($tempExtraItems['post'] as $key => $item) { $item['extParams'] = array('beforeAction' => ''); $item['type'] = $item['action']; $item['action'] = ''; if ($item['type'] == 'support' && !$isWater) { $item['action'] = WebUtils::createUrl_oldVersion('forum/support', array('tid' => $tid, 'pid' => $post['pid'], 'type' => 'post')); $item['extParams']['recommendAdd'] = (int) $tempPostRecommends[$post['pid']]['support']; $isRecommendAdd = in_array($post['pid'], $isSupport) ? 1 : 0; $item['extParams']['isHasRecommendAdd'] = (int) $isRecommendAdd; } if ($item['type'] != 'support' || !$isWater) { $extraItems[] = $item; } } $postInfo['managePanel'] = $manageItems['post']; $postInfo['extraPanel'] = $extraItems; $postInfos[] = $postInfo; } } $res = WebUtils::getWebApiArrayWithPage_oldVersion($page, $pageSize, $postCount, $res); $res['list'] = $postInfos; return $res; }
</div> <div class="col-sm-xs-8 col-sm-8 col-md-8" id="operation"> <div id="module-edit-dlg-view" class="module-play"> </div> <div class="uidiy-config-admin"> <div class="form-group"> <div class="form-group"> <input type="file" class="uidiy-config-file"> </div> <div class="form-group"> <button class="uidiy-config-import-btn btn btn-default btn-xs">导入配置</button> <a href="<?php echo WebUtils::createUrl_oldVersion('admin/uidiy/exportconfig'); ?> " class="btn btn-default btn-xs">导出配置</a> (仅导出当前已保存的配置) </div> </div> </div> <div class="text-left"> <p> 请点击 <button class="btn btn-primary btn-xs uidiy-save-btn"> 保存 </button> 按钮来保存你的客户端UI配置, 或者可以勾选 <label for="autoSaveCheckbox"> <input type="checkbox" id="autoSaveCheckbox" class="align-text"> 自动保存 </label> </p> <p>PS: 这里仅仅保存你在后台的配置, 如果想同步到客户端, 请点击 <a href="#save-btn" target"_self" class="save-btn">下面</a> 的同步按钮</p> </div>
<?php header("Content-Type: text/html; charset=utf-8"); ?> <!doctype html> <html> <head> <meta charset="utf-8"> </head> <body> <table> <?php foreach ($testApiList as $api) { printf('<tr><td><a href="%s" target="_blank">%s</td></tr>', WebUtils::createUrl_oldVersion($api['route'], array_merge($api['params'], $_GET)), $api['title']); } ?> </table> </body> </html>
private function _renderTemplates($tid, $pid, $errorMsg = '') { global $_G; require_once libfile('function/misc'); //今日剩余积分 $maxratetoday = $this->_getratingleft($_G['group']['raterange']); //评分栏目列表 $ratelist = $this->_getratelist($_G['group']['raterange']); $ratelist = WebUtils::emptyHtml($ratelist); //评分理由 $selectreason = explode("\n", modreasonselect(0, 'userreasons')); $selectreason = str_replace('</li>', '', $selectreason); $selectreason = explode('<li>', $selectreason[0]); $this->getController()->renderPartial('topicRate', array('formUrl' => WebUtils::createUrl_oldVersion('forum/topicrate', array('tid' => $tid, 'pid' => $pid)), 'errorMsg' => $errorMsg, 'ratelist' => $ratelist, 'maxratetoday' => $maxratetoday, 'selectreason' => $selectreason)); }
</head> <body> <div style="margin-top:15px;" class="zhiding"> <form method="post" action="<?php echo $formUrl; ?> "> <table cellpadding="0" cellspacing="0" class="fwin" width="100%"> <tr> <?php $base = WebUtils::createUrl_oldVersion('user/userinfoadminview', array('act' => 'base')); $contact = WebUtils::createUrl_oldVersion('user/userinfoadminview', array('act' => 'contact')); $edu = WebUtils::createUrl_oldVersion('user/userinfoadminview', array('act' => 'edu')); $work = WebUtils::createUrl_oldVersion('user/userinfoadminview', array('act' => 'work')); $info = WebUtils::createUrl_oldVersion('user/userinfoadminview', array('act' => 'info')); ?> <select name="pageselect" onchange="self.location.href=options[selectedIndex].value" > <option value="<?php echo $base; ?> " <?php if ($action == "base") { echo "selected='selected'"; } ?> >基本资料</option> <option value="<?php echo $contact; ?> " <?php