/** * 获取评论列表,已在后台被使用 * @param array $map 查询条件 * @param string $order 排序条件,默认为comment_id ASC * @param integer $limit 结果集数目,默认为10 * @param boolean $isReply 是否显示回复信息 * @return array 评论列表信息 */ public function getCommentList($map = null, $order = 'comment_id ASC', $limit = 10, $isReply = false) { !$map['app'] && $this->_app && ($map['app'] = $this->_app); !$map['table'] && $this->_app_table && ($map['table'] = $this->_app_table); !isset($map['is_del']) && ($map['is_del'] = 0); $data = $this->where($map)->order($order)->findPage($limit); // dump($data);exit; // TODO:后续优化 foreach ($data['data'] as &$v) { if (!empty($v['to_comment_id']) && $isReply) { $replyInfo = $this->setAppName($map['app'])->setAppTable($map['table'])->getCommentInfo(intval($v['to_comment_id']), false); $v['replyInfo'] = '//@{uid=' . $replyInfo['user_info']['uid'] . '|' . $replyInfo['user_info']['uname'] . '}:' . $replyInfo['content']; } $v['user_info'] = model('User')->getUserInfo($v['uid']); $groupData = static_cache('groupdata' . $v['uid']); if (!$groupData) { $groupData = model('UserGroupLink')->getUserGroupData($v['uid']); if (!$groupData) { $groupData = 1; } static_cache('groupdata' . $v['uid'], $groupData); } $v['user_info']['groupData'] = $groupData; //获取用户组信息 $v['content'] = parse_html($v['content'] . $v['replyInfo']); $v['sourceInfo'] = model('Source')->getSourceInfo($v['table'], $v['row_id'], false, $v['app']); //$v['data'] = unserialize($v['data']); } return $data; }
/** * 系统通知 * @return void */ public function notify() { //$list = model('Notify')->getMessageList($this->mid); //2012/12/27 //下边这句是为了获取$count $limit = 20; $list = D('notify_message')->where('uid=' . $this->mid)->order('ctime desc')->findpage($limit); $count = $list['count']; $this->assign('count', $count); $page = $_GET['page'] ? intval($_GET['page']) : 1; $start = ($page - 1) * $limit; $list = D('notify_message')->where('uid=' . $this->mid)->order('ctime desc')->limit("{$start},{$limit}")->select(); foreach ($list as $k => $v) { $list[$k]['body'] = parse_html($v['body']); if ($appname != 'public') { $list[$k]['app'] = model('App')->getAppByName($v['appname']); } } model('Notify')->setRead($this->mid); $this->assign('page', $page); $this->assign('list', $list); $this->setTitle(L('PUBLIC_MESSAGE_NOTIFY')); $this->setKeywords(L('PUBLIC_MESSAGE_NOTIFY')); $this->assign('headtitle', '系统通知'); $this->display('mynotify'); }
function parse_response($api, $params) { global $records; $page = $params['from'] / $params['size'] + 1; echo "Page {$page}\n"; //compare the individual request parameters into k=>v pairs to the URL $qparams = array(); foreach ($params as $k => $v) { $qparams[] = "{$k}=" . urlencode($v); } $service = $api . implode('&', $qparams); //request JSON from API $json = file_get_contents($service); $data = json_decode($json); //iterate through results foreach ($data->results as $result) { $record = array(); $record['id'] = $result->priref; $record['uri'] = "http://data.fitzmuseum.cam.ac.uk/id/object/{$result->priref}"; $record['objectnumber'] = $result->ObjectNumber; $record['title'] = "Fitzwilliam Museum - Object {$result->ObjectNumber}"; $imageCount = 0; foreach ($result->images->thumbnailURI as $url) { switch ($imageCount) { case 0: $record['obv_image'] = $url; break; case 1: $record['rev_image'] = $url; } $imageCount++; } //begin screen scraping $url = "http://webapps.fitzmuseum.cam.ac.uk/explorer/index.php?oid={$result->priref}"; $fields = parse_html($url); if (isset($fields['reference'])) { $record['reference'] = $fields['reference']; } if (isset($fields['coinType'])) { $record['cointype'] = $fields['coinType']; } if (isset($fields['weight'])) { $record['weight'] = $fields['weight']; } if (isset($fields['axis'])) { $record['axis'] = $fields['axis']; } $records[] = $record; } //var_dump($records); //if there are more pages to parse, curse function $numFound = $data->total; if ($params['from'] + $params['size'] <= $numFound) { $params['from'] = $params['from'] + $params['size']; parse_response($api, $params); } }
/** * 获取回复列表 * @param array $map 查询条件 * @param string $order 排序条件,默认为comment_id ASC * @param integer $limit 结果集数目,默认为10 * @return array 评论列表信息 */ public function getReplyList($map = null, $order = 'reply_id desc', $limit = 10) { !isset($map['is_del']) && ($map['is_del'] = 0); $data = $this->where($map)->order($order)->findPage($limit); // // TODO:后续优化 foreach ($data['data'] as &$v) { $v['user_info'] = model('User')->getUserInfo($v['uid']); $v['user_info']['groupData'] = model('UserGroupLink')->getUserGroupData($v['uid']); //获取用户组信息 $v['content'] = parse_html(h(htmlspecialchars($v['content']))); //$v['sourceInfo'] = model('Source')->getSourceInfo($v['table'], $v['row_id'], false, $v['app']); } return $data; }
public function tz() { $map['uid'] = $this->mid; $list = D('notify_message')->where($map)->order('ctime desc')->findpage(20); foreach ($list['data'] as $k => $v) { $list['data'][$k]['body'] = parse_html($v['body']); if ($v['appname'] != 'public') { $list['data'][$k]['app'] = model('App')->getAppByName($v['appname']); } } model('Notify')->setRead($this->mid); $this->assign('list', $list); $this->display(); }
/** * 系统通知 * @return void */ public function notify() { //$list = model('Notify')->getMessageList($this->mid); //2012/12/27 $list = D('notify_message')->where('uid=' . $this->mid)->order('ctime desc')->findpage(20); foreach ($list['data'] as $k => $v) { $list['data'][$k]['body'] = parse_html($v['body']); if ($appname != 'public') { $list['data'][$k]['app'] = model('App')->getAppByName($v['appname']); } } model('Notify')->setRead($this->mid); $this->assign('list', $list); // dump($list); $this->setTitle(L('PUBLIC_MESSAGE_NOTIFY')); $this->setKeywords(L('PUBLIC_MESSAGE_NOTIFY')); $this->display('mynotify'); }
/** * 获取回复列表 * @param array $map 查询条件 * @param string $order 排序条件,默认为comment_id ASC * @param int $limit 结果集数目,默认为10 * @return array 评论列表信息 */ public function getReplyList($map = null, $order = 'reply_id desc', $limit = 10) { !isset($map['is_del']) && ($map['is_del'] = 0); $data = $this->where($map)->order($order)->findPage($limit); // // TODO:后续优化 foreach ($data['data'] as &$v) { $v['user_info'] = model('User')->getUserInfo($v['uid']); $v['user_info']['groupData'] = model('UserGroupLink')->getUserGroupData($v['uid']); //获取用户组信息 $v['content'] = parse_html(h(htmlspecialchars($v['content']))); //$v['sourceInfo'] = model('Source')->getSourceInfo($v['table'], $v['row_id'], false, $v['app']); $v['attach_info'] = model('Attach')->getAttachById($v['attach_id']); if ($v['attach_info']['attach_type'] == 'weiba_comment_image' || $v['attach_info']['attach_type'] == 'feed_image') { $v['attach_info']['attach_url'] = getImageUrl($v['attach_info']['save_path'] . $v['attach_info']['save_name'], 590); } } return $data; }
function get_data($num, $url) { $str = file_get_contents($url); $str = trim($str); $str = strtolower($str); if ($str == '') { $str = file_get_contents($url); } if ($str == '') { // recode error $fp = fopen('cantdown_' . $num, 'a+'); fputs($fp, $num . '\\r\\n'); fclose($fp); } else { $data = parse_html($str); if (insert_db($num, $data)) { echo $num . "is ok \r\n"; } } }
public function edit($_id = '') { $this->assigns_layout["gnb_left"] = "contents"; if ($_REQUEST["subject"]) { $content_parsed = parse_html($_REQUEST["contents"]); foreach ($content_parsed as $c) { if (strtolower(substr($c, 0, 4)) == "<img") { $t = tag_barase($c); if ($t["src"]) { $_REQUEST["img"] = $t["src"]; break; } } } $_id = $this->Content->add($_REQUEST); if ($_REQUEST["pic"]) { $img_temp_name = str_replace(" ", "", $_REQUEST['pic']); $ck = substr($img_temp_name, 0, 1); if ($ck == '/') { $img_temp_name = substr($img_temp_name, 1, strlen($img_temp_name) - 1); } $file_ext = explode('.', $img_temp_name); //$filename = basename($_FILES['file']['name']); $file_ext = '.' . $file_ext[sizeof($file_ext) - 1]; $original_file = $this->settings->root_path . $img_temp_name; $copy_file = $this->settings->root_path . 'media/contents/' . $_id . $file_ext; GD2_make_thumb_x(300, "", $original_file); //그림 파일 update 폴더로 옮긴 후 임시파일 삭제 copy($original_file, $copy_file); unlink($original_file); $_pic = '/media/contents/' . $_id . $file_ext; $this->Content->add_picture($_id, $_pic); } header("Location: /admin_contents"); } if ($_id) { $this->assigns["res"] = $this->Content->get($_id); } $this->assigns["cat"] = $this->Content_category->list_(1, 100); }
/** * [ 获取评论的评论列表] * @return [type] [description] */ public function reply_commentList() { if (!CheckPermission('weiba_normal', 'weiba_reply')) { return false; } $var = $_POST; $var['initNums'] = model('Xdata')->getConfig('weibo_nums', 'feed'); $var['commentInfo'] = model('Comment')->getCommentInfo($var['comment_id'], false); $var['canrepost'] = $var['commentInfo']['table'] == 'feed' ? 1 : 0; $var['cancomment'] = 1; // 获取原作者信息 $rowData = model('Feed')->get(intval($var['commentInfo']['row_id'])); $appRowData = model('Feed')->get($rowData['app_row_id']); $var['user_info'] = $appRowData['user_info']; // 微博类型 $var['feedtype'] = $rowData['type']; // $var['cancomment_old'] = ($var['commentInfo']['uid'] != $var['commentInfo']['app_uid'] && $var['commentInfo']['app_uid'] != $this->uid) ? 1 : 0; if ($var['flag'] != 1) { $var['initHtml'] = L('PUBLIC_STREAM_REPLY') . '@' . $var['commentInfo']['user_info']['uname'] . ' :'; } //获取回评 $commentList = D('weiba_reply')->where('is_del = 0 and to_reply_id=' . $var['to_reply_id'])->order('ctime')->select(); foreach ($commentList as $k => $v) { $commentList[$k]['content'] = parse_html(h(htmlspecialchars($v['content']))); } $this->assign('commentList', $commentList); $uids = getSubByKey($commentList, 'uid'); $this->_assignUserInfo($uids); $this->assign('reply_id', $var['to_reply_id']); $this->assign('var', $var); if ($var[type] == 2) { $con = $this->fetch('reply_commentList1'); } else { $con = $this->fetch(); } echo $con; }
/** * 添加评论操作 * @param array $data 评论数据 * @param boolean $forApi 是否用于API,默认为false * @param boolean $notCount 是否统计到未读评论 * @param array $lessUids 除去@用户ID * @return boolean 是否添加评论成功 */ public function addComment($data, $forApi = false, $notCount = false, $lessUids = null) { // 判断用户是否登录 if (!$GLOBALS['ts']['mid']) { $this->error = L('PUBLIC_REGISTER_REQUIRED'); // 请先登录 return false; } if (isSubmitLocked()) { $this->error = '发布内容过于频繁,请稍后再试!'; return false; } /* # 将Emoji编码 */ $data['content'] = formatEmoji(true, $data['content']); // 检测数据安全性 $add = $this->_escapeData($data); if ($add['content'] === '') { $this->error = L('PUBLIC_COMMENT_CONTENT_REQUIRED'); // 评论内容不可为空 return false; } $add['is_del'] = 0; //判断是否先审后发 $filterStatus = filter_words($add['content']); $weiboSet = model('Xdata')->get('admin_Config:feed'); $weibo_premission = $weiboSet['weibo_premission']; if (in_array('audit', $weibo_premission) || CheckPermission('core_normal', 'feed_audit') || $filterStatus['type'] == 2) { $add['is_audit'] = 0; } else { $add['is_audit'] = 1; } $add['client_ip'] = get_client_ip(); $add['client_port'] = get_client_port(); if ($res = $this->add($add)) { //锁定发布 lockSubmit(); //添加楼层信息 弃用 20130607 /* $storeyCount = $this->where("table='".$add['table']."' and row_id=".$data['row_id'].' and comment_id<'.$res)->count(); $this->where('comment_id='.$res)->setField('storey',$storeyCount+1); */ if (!$add['is_audit']) { $touid = D('user_group_link')->where('user_group_id=1')->field('uid')->findAll(); $touidArr = getSubByKey($touid, 'uid'); model('Notify')->sendNotify($touidArr, 'comment_audit'); } // 获取排除@用户ID $lessUids[] = intval($data['app_uid']); !empty($data['to_uid']) && ($lessUids[] = intval($data['to_uid'])); // 获取用户发送的内容,仅仅以//进行分割 $scream = explode('//', $data['content']); model('Atme')->setAppName('Public')->setAppTable('comment')->addAtme(trim($scream[0]), $res, null, $lessUids); // 被评论内容的“评论统计数”加1,同时可检测出app,table,row_id的有效性 $pk = D($add['table'])->getPk(); $where = "`{$pk}`={$add['row_id']}"; D($add['table'])->setInc('comment_count', $where); //兼容旧版本app // D($add['table'])->setInc('commentCount', $where); // D($add['table'])->setInc('comment_all_count', $where); D($add['app'])->setInc('commentCount', $where); D($add['app'])->setInc('comment_all_count', $where); //评论时间 M($add['app'])->where('feed_id=' . $add['row_id'])->setField('rTime', time()); // 给应用UID添加一个未读的评论数 原作者 if ($GLOBALS['ts']['mid'] != $add['app_uid'] && $add['app_uid'] != '' && $add['app_uid'] != $add['to_uid']) { !$notCount && model('UserData')->updateKey('unread_comment', 1, true, $add['app_uid']); } // 回复发送提示信息 if (!empty($add['to_uid']) && $add['to_uid'] != $GLOBALS['ts']['mid']) { !$notCount && model('UserData')->updateKey('unread_comment', 1, true, $add['to_uid']); } // 加积分操作 if ($add['table'] == 'feed') { model('Credit')->setUserCredit($GLOBALS['ts']['mid'], 'comment_weibo'); model('Credit')->setUserCredit($data['app_uid'], 'commented_weibo'); model('Feed')->cleanCache($add['row_id']); } // 发邮件 if ($add['to_uid'] != $GLOBALS['ts']['mid'] || $add['app_uid'] != $GLOBALS['ts']['mid'] && $add['app_uid'] != '') { $author = model('User')->getUserInfo($GLOBALS['ts']['mid']); $config['name'] = $author['uname']; $config['space_url'] = $author['space_url']; $config['face'] = $author['avatar_small']; $sourceInfo = model('Source')->getCommentSource($add, $forApi); $config['content'] = parse_html($add['content']); $config['ctime'] = date('Y-m-d H:i:s', time()); $config['sourceurl'] = $sourceInfo['source_url']; $config['source_content'] = parse_html($sourceInfo['source_content']); $config['source_ctime'] = isset($sourceInfo['ctime']) ? date('Y-m-d H:i:s', $sourceInfo['ctime']) : date('Y-m-d H:i:s'); if (!empty($add['to_uid'])) { // 回复 $config['comment_type'] = '回复 我 的评论:'; model('Notify')->sendNotify($add['to_uid'], 'comment', $config); } else { // 评论 $config['comment_type'] = '评论 我 的分享:'; if (!empty($add['app_uid'])) { model('Notify')->sendNotify($add['app_uid'], 'comment', $config); } } } } $this->error = $res ? L('PUBLIC_CONCENT_IS_OK') : L('PUBLIC_CONCENT_IS_ERROR'); // 评论成功,评论失败 return $res; }
/** * 添加评论操作 * @param array $data 评论数据 * @param boolean $forApi 是否用于API,默认为false * @param boolean $notCount 是否统计到未读评论 * @param array $lessUids 除去@用户ID * @return boolean 是否添加评论成功 */ public function addComment($data, $forApi = false, $notCount = false, $lessUids = null) { // 判断用户是否登录 if (!$GLOBALS['ts']['mid']) { $this->error = L('PUBLIC_REGISTER_REQUIRED'); // 请先登录 return false; } // 设置评论绝对楼层 //$data['data']['storey'] = $this->getStorey($data['row_id'], $data['app'], $data['table']); // 检测数据安全性 $add = $this->_escapeData($data); if ($add['content'] === '') { $this->error = L('PUBLIC_COMMENT_CONTENT_REQUIRED'); // 评论内容不可为空 return false; } $add['is_del'] = 0; //判断是否先审后发 $weiboSet = model('Xdata')->get('admin_Config:feed'); $weibo_premission = $weiboSet['weibo_premission']; if (in_array('audit', $weibo_premission) || CheckPermission('core_normal', 'feed_audit')) { $add['is_audit'] = 0; } else { $add['is_audit'] = 1; } if ($res = $this->add($add)) { //添加楼层信息 $storeyCount = $this->where('row_id=' . $data['row_id'] . ' and comment_id<' . $res)->count(); $this->where('comment_id=' . $res)->setField('storey', $storeyCount + 1); if (!$add['is_audit']) { $touid = D('user_group_link')->where('user_group_id=1')->field('uid')->findAll(); foreach ($touid as $k => $v) { model('Notify')->sendNotify($v['uid'], 'comment_audit'); } } // 获取排除@用户ID $lessUids[] = intval($data['app_uid']); !empty($data['to_uid']) && ($lessUids[] = intval($data['to_uid'])); // 获取用户发送的内容,仅仅以//进行分割 $scream = explode('//', $data['content']); model('Atme')->setAppName('Public')->setAppTable('comment')->addAtme(trim($scream[0]), $res, null, $lessUids); // 被评论内容的“评论统计数”加1,同时可检测出app,table,row_id的有效性 $pk = D($add['table'])->getPk(); D($add['table'])->setInc('comment_count', "`{$pk}`={$add['row_id']}", 1); D($add['table'])->setInc('comment_all_count', "`{$pk}`={$add['row_id']}", 1); // 给应用UID添加一个未读的评论数 原作者 if ($GLOBALS['ts']['mid'] != $add['app_uid'] && $add['app_uid'] != '') { !$notCount && model('UserData')->updateKey('unread_comment', 1, true, $add['app_uid']); } // 回复发送提示信息 if (!empty($add['to_uid']) && $add['to_uid'] != $GLOBALS['ts']['mid']) { !$notCount && model('UserData')->updateKey('unread_comment', 1, true, $add['to_uid']); } // 加积分操作 if ($add['table'] == 'feed') { model('Credit')->setUserCredit($GLOBALS['ts']['mid'], 'comment_weibo'); model('Credit')->setUserCredit($data['app_uid'], 'commented_weibo'); model('Feed')->cleanCache($add['row_id']); } // 发邮件 if ($add['to_uid'] != $GLOBALS['ts']['mid'] || $add['app_uid'] != $GLOBALS['ts']['mid'] && $add['app_uid'] != '') { $author = model('User')->getUserInfo($GLOBALS['ts']['mid']); $config['name'] = $author['uname']; $config['space_url'] = $author['space_url']; $config['face'] = $author['avatar_middle']; $sourceInfo = model('Source')->getSourceInfo($add['table'], $add['row_id'], $forApi, $add['app']); $config['content'] = parse_html($add['content']); $config['ctime'] = date('Y-m-d H:i:s', time()); $config['sourceurl'] = $sourceInfo['source_url']; $config['source_content'] = parse_html($sourceInfo['source_content']); $config['source_ctime'] = date('Y-m-d H:i:s', $sourceInfo['ctime']); if (!empty($add['to_uid'])) { // 回复 $config['comment_type'] = '回复 我 的评论:'; model('Notify')->sendNotify($add['to_uid'], 'comment', $config); } else { // 评论 $config['comment_type'] = '评论 我 的微博:'; if (!empty($add['app_uid'])) { model('Notify')->sendNotify($add['app_uid'], 'comment', $config); } } } } $this->error = $res ? L('PUBLIC_CONCENT_IS_OK') : L('PUBLIC_CONCENT_IS_ERROR'); // 评论成功,评论失败 return $res; }
function regular_express($regexp_array, $thevar) { #$regexp_array[2].='S'; # in benchmarks, this 'optimization' appeared to not do anything at all, or possibly even slow things down if ($regexp_array[0] == 1) { $newvar = preg_replace($regexp_array[2], $regexp_array[3], $thevar); } elseif ($regexp_array[0] == 2) { $addproxy = isset($regexp_array[4]) ? $regexp_array[4] : true; $framify = isset($regexp_array[5]) ? $regexp_array[5] : false; $newvar = parse_html($regexp_array[2], $regexp_array[3], $thevar, $addproxy, $framify); } return $newvar; }
$sql = "select server, user, password, race, main_village, last_report from accounts where id = {$account}"; $res = mysql_query($sql); if (!$res) { die(mysql_error()); } $row = mysql_fetch_row($res); if (!$row) { die("Account not found. {$account} \n"); } $server = $row[0]; $url = "http://{$server}/dorf1.php"; $ch = my_curl_init(); curl_setopt($ch, CURLOPT_URL, $url); $result = curl_exec($ch); curl_close($ch); $all_id = parse_html($result); $db_all = array(); $sql = "select id from villages where account = {$account}"; $res = mysql_query($sql); if (!$res) { die(mysql_error()); } while ($row = mysql_fetch_row($res)) { $id = $row[0]; array_push($db_all, $id); } foreach ($all_id as $id => $val) { $name = mysql_escape_string($val[0]); $x = $val[1]; $y = $val[2]; if (in_array($id, $db_all)) {
echo '</fieldset>' . "\n"; echo '</form>' . "\n"; } else { echo 'nothing to do.'; } // $file } elseif (isset($_POST['valider']) and !empty($_FILES['file']['tmp_name'])) { $message = array(); switch ($_POST['imp-format']) { case 'jsonbak': $json = file_get_contents($_FILES['file']['tmp_name']); $message = importer_json($json); break; case 'htmllinks': $html = file_get_contents($_FILES['file']['tmp_name']); $message['links'] = insert_table_links(parse_html($html)); break; case 'xmlwp': $xml = file_get_contents($_FILES['file']['tmp_name']); $message = importer_wordpress($xml); break; case 'rssopml': $xml = file_get_contents($_FILES['file']['tmp_name']); $message['feeds'] = importer_opml($xml); break; default: die('nothing'); break; } if (!empty($message)) { echo '<form action="maintenance.php" method="get" class="bordered-formbloc">' . "\n";
/** * 获取@内容中的@用户 * @param string $content @Me的相关内容 * @param array $extra_uids 额外@用户UID * @param integer $row_id 资源ID * @param array $less_uids 去除@用户ID * @return array 用户UID数组 */ public function getUids($content, $extra_uids = null, $row_id, $less_uids = null) { // 正则匹配内容 preg_match_all($this->_at_regex, $content, $matches); $unames = $matches[1]; $map = "uname in ('" . implode("','", $unames) . "')"; $ulist = model('User')->where($map)->field('uid')->findall(); $matchuids = getSubByKey($ulist, 'uid'); // 如果内容匹配中没有用户 if (empty($matchuids) && !empty($extra_uids)) { // 去除@用户ID if (!empty($less_uids)) { foreach ($less_uids as $k => $v) { if (in_array($v, $extra_uids)) { unset($extra_uids[$k]); } } } return is_array($extra_uids) ? $extra_uids : array($extra_uids); } // 如果匹配内容中存在用户 $suid = array(); foreach ($matchuids as $v) { !in_array($v, $suid) && ($suid[] = (int) $v); } // 去除@用户ID if (!empty($less_uids)) { foreach ($suid as $k => $v) { if (in_array($v, $less_uids)) { unset($suid[$k]); } } } // 发邮件流程 $author = model('User')->getUserInfo($GLOBALS['ts']['mid']); $content = model('Source')->getSourceInfo($this->_app_table, $row_id, false, $this->_app); $config['content'] = parse_html($content['source_content']); $config['publish_time'] = date('Y-m-d H:i:s', $content['ctime']); $config['feed_url'] = $content['source_url']; $config['name'] = $author['uname']; $config['space_url'] = $author['space_url']; $config['face'] = $author['avatar_small']; foreach ($suid as $u_v) { model('Notify')->sendNotify($u_v, 'atme', $config); } /* if(in_array('atme',MailModel::$allowed)){ foreach($suid as $u_v){ $v = array('table'=>$this->_app_table,'app'=>$this->_app,'row_id'=>$row_id,'uid'=>$u_v); $toUser = model('User')->getUserInfo($u_v); $map['key'] = 'email'; $map['uid'] = $u_v; $isEmail = D('user_privacy')->where($map)->field('value')->find(); if($isEmail['value'] == 0){ $content = model('Source')->getSourceInfo($v['table'],$v['row_id'],false,$v['app']); //model('Mail')->send_email($toUser['email'],'atme','',array('content'=>parse_html($content['source_content']))); model('Mail')->send_email($toUser['email'],$author['uname'].'在微博中@提到了您',parse_html($content['source_content'])); } unset($map); unset($isEmail); } }*/ return array_unique(array_filter(array_merge($suid, (array) $extra_uids))); }
foreach ($C->RECORD_URLS as $site => $urls) { if (is_array($urls) && count($urls) == 0) { continue; } foreach ($urls as $k => $v) { $url = str_replace('*****', $v, $val); $cnt = 0; $tmp = FALSE; while ($cnt < 3 && ($tmp = @get_sources($url)) === FALSE) { $cnt++; sleep(4); } if (!$tmp) { $r[$key][$site][$v] = 0; } else { $r[$key][$site][$v] = parse_html($tmp); //$r[引擎类型][主站][搜索url] } ob_flush(); flush(); echo $v . " ======== " . $r[$key][$site][$v] . "\n"; sleep(3); //抓取间隔5s } } } //var_dump($r); //save $timestamp = strtotime('last day'); $filename = date('Ym', $timestamp) . '.txt'; $today = getdate($timestamp);
function cron_check_for_new_content() { // caut combinatiile url, tag distincte pentru a cauta in net modificari $distinct_tags = select("distinct(Concat_ws('_', url,tag)), url,tag", 'user_stuffs'); if($distinct_tags) foreach($distinct_tags as $row) { //parsez html $result = parse_html($row['url'], $row['tag']); //daca nu mai pot identifica portiunea de cod html in mod unnic if(sizeof($result) != 1) { $update = array( 'id' => $row['id'], 'time_modified' => date('Y-m-d H:i:s'), 'status' => 2 // not found ); insert('user_stuffs', $update,'id'); } else { $plaintext = md5($result->plaintext); // daca s-a modificat, inregistrez in db if($update['plaintext'] != $row['plaintext']) { $update = array( 'id' => $row['id'], 'time_modified' => date('Y-m-d H:i:s'), 'status' => 1, 'plaintext' => $plaintext ); insert('user_stuffs', $update,'id'); } } } }
function get_href_from_anchor_tag($str) { // <a href="reference_detail.cfm?ref_number=58&type=Article"> $beg = 'href="'; $end1 = '">'; return trim(parse_html($str, $beg, $end1, $end1, $end1, $end1, "", true)); //exist on first match = true }
public function addReport() { // 获取传入的值 $post = $_POST; // 安全过滤 foreach ($post as $key => $val) { $post[$key] = t($post[$key]); } // 过滤内容值 $post['body'] = filter_keyword($post['body']); // 判断资源是否删除 if (empty($post['curid'])) { $map['feed_id'] = $post['sid']; } else { $map['feed_id'] = $post['curid']; } $map['is_del'] = 0; $isExist = model('Feed')->where($map)->count(); if ($isExist == 0) { $return['status'] = 0; $return['data'] = '内容已被删除,转发失败'; exit(json_encode($return)); } // 进行分享操作 $return = model('Share')->shareFeed($post, 'share'); if ($return['status'] == 1) { $app_name = $post['app_name']; // 添加积分 if ($app_name == 'public') { model('Credit')->setUserCredit($this->uid, 'forward_weibo'); //微博被转发 $suid = model('Feed')->where($map)->getField('uid'); model('Credit')->setUserCredit($suid, 'forwarded_weibo'); } if ($app_name == 'weiba') { model('Credit')->setUserCredit($this->uid, 'forward_topic'); //微博被转发 $suid = D('Feed')->where('feed_id=' . $map['feed_id'])->getField('uid'); model('Credit')->setUserCredit($suid, 'forwarded_topic'); } $this->assign($return['data']); // 微博配置 $weiboSet = model('Xdata')->get('admin_Config:feed'); $this->assign('weibo_premission', $weiboSet['weibo_premission']); $html = '<dl class="comment_list"> <dt><a href="' . $return['data']['user_info']['space_url'] . '"><img src="' . $return['data']['user_info']['avatar_tiny'] . '" width="30" height="30"/></a></dt> <dd> <p class="cont">' . $return['data']['user_info']['space_link'] . ':<em>' . str_replace('__THEME__', THEME_PUBLIC_URL, parse_html($return['data']['content'])) . '<span class="time">(' . friendlyDate($return['data']['publish_time']) . ')</span></em></p> <p class="right mt5"><span><a href="javascript:;" onclick="shareFeed(' . $return['data']['feed_id'] . ', ' . $return['data']['curid'] . ');">转发</a></span></p> </dd> </dl>'; $return['data'] = $html; } exit(json_encode($return)); }
if ($config['_mail_to']) { write_mail(); } if ($config['_save_csv']) { write_csv($config['_csv_directory'] . '/' . $config['_save_csv'] . '.csv'); } if ($config['_save_database']) { write_database($config['_save_database']); } if ($config['_mail_confirm']) { write_receipt(); } if (empty($config['_html_thanks'])) { parse_html($config['_html_return'], $store); } else { parse_html($config['_html_thanks'], $store); } } exit; // === C O D E ========================================================== /** * make sure the script is called from this server only * otherwise exit to block usage */ function check_referer($ref) { // get host name from URL preg_match("/^http:\\/\\/([^\\/]+)/i", $ref, $matches); $host = isset($matches[1]) ? $matches[1] : ''; if (!($host == '' || in_array($host, $GLOBALS['hosts_allow']))) { print "<html><head><title>ZUGRIFF UNERW&UUML;NSCHT</title></head><body><h3 style=\"color:red;\"></h3>Sie sind nicht berechtigt auf diesen Service über '{$host}' zuzugreifen.</body></html>";
public function at($data) { $html = "@{uid=14983|yangjiasheng}"; echo parse_html($html); }
/** * 提到我的微博页面 */ public function index() { // 获取未读@Me的条数 $this->assign('unread_atme_count', model('UserData')->where('uid=' . $this->mid . " and `key`='unread_atme'")->getField('value')); // 拼装查询条件 $map['uid'] = $this->mid; $d['tab'] = model('Atme')->getTab(null); foreach ($d['tab'] as $key => $vo) { if ($key == 'feed') { $d['tabHash']['feed'] = L('PUBLIC_WEIBO'); } elseif ($key == 'comment') { $d['tabHash']['comment'] = L('PUBLIC_STREAM_COMMENT'); } else { $langKey = 'PUBLIC_APPNAME_' . strtoupper($key); $lang = L($langKey); if ($lang == $langKey) { $d['tabHash'][$key] = ucfirst($key); } else { $d['tabHash'][$key] = $lang; } } } $this->assign($d); !empty($_GET['t']) && ($map['table'] = t($_GET['t'])); // 设置应用名称与表名称 $app_name = isset($_GET['app_name']) ? t($_GET['app_name']) : 'public'; // $app_table = isset($_GET['app_table']) ? t($_GET['app_table']) : ''; // 获取@Me微博列表 $at_list = model('Atme')->setAppName($app_name)->setAppTable($app_table)->getAtmeList($map); // 赞功能 $feed_ids = getSubByKey($at_list['data'], 'feed_id'); $diggArr = model('FeedDigg')->checkIsDigg($feed_ids, $GLOBALS['ts']['mid']); $this->assign('diggArr', $diggArr); // dump($at_list);exit; // 添加Widget参数数据 foreach ($at_list['data'] as &$val) { if ($val['source_table'] == 'comment') { $val['widget_sid'] = $val['sourceInfo']['source_id']; $val['widget_style'] = $val['sourceInfo']['source_table']; $val['widget_sapp'] = $val['sourceInfo']['app']; $val['widget_suid'] = $val['sourceInfo']['uid']; $val['widget_share_sid'] = $val['sourceInfo']['source_id']; } else { if ($val['is_repost'] == 1) { $val['widget_sid'] = $val['source_id']; $val['widget_stype'] = $val['source_table']; $val['widget_sapp'] = $val['app']; $val['widget_suid'] = $val['uid']; $val['widget_share_sid'] = $val['app_row_id']; $val['widget_curid'] = $val['source_id']; $val['widget_curtable'] = $val['source_table']; } else { $val['widget_sid'] = $val['source_id']; $val['widget_stype'] = $val['source_table']; $val['widget_sapp'] = $val['app']; $val['widget_suid'] = $val['uid']; $val['widget_share_sid'] = $val['source_id']; } } // 获取转发与评论数目 if ($val['source_table'] != 'comment') { $feedInfo = model('Feed')->get($val['widget_sid']); $val['repost_count'] = $feedInfo['repost_count']; $val['comment_count'] = $feedInfo['comment_count']; } // 解析数据成网页端显示格式(@xxx 加链接) $val['source_content'] = parse_html($val['source_content']); } // 获取微博设置 $weiboSet = model('Xdata')->get('admin_Config:feed'); $this->assign($weiboSet); // 用户@Me未读数目重置 // model('UserCount')->resetUserCount($this->mid, 'unread_atme', 0); $this->setTitle(L('PUBLIC_MENTION_INDEX')); $userInfo = model('User')->getUserInfo($this->mid); $this->setKeywords('@提到' . $userInfo['uname'] . '的消息'); $this->assign($at_list); $this->display(); }
/** * 解析微博模板标签 * @param array $_data 微博的原始数据 * @return array 解析微博模板后的微博数据 */ private function __paseTemplate($_data) { // 获取作者信息 $user = model('User')->getUserInfo($_data['uid']); // 处理数据 $_data['data'] = unserialize($_data['feed_data']); // 模版变量赋值 $var = $_data['data']; if (!empty($var['attach_id'])) { $var['attachInfo'] = model('Attach')->getAttachByIds($var['attach_id']); foreach ($var['attachInfo'] as $ak => $av) { $_attach = array('attach_id' => $av['attach_id'], 'attach_name' => $av['name'], 'attach_url' => getImageUrl($av['save_path'] . $av['save_name']), 'extension' => $av['extension'], 'size' => $av['size']); if ($_data['type'] == 'postimage') { $_attach['attach_small'] = getImageUrl($av['save_path'] . $av['save_name'], 100, 100, true); $_attach['attach_middle'] = getImageUrl($av['save_path'] . $av['save_name'], 550); } $var['attachInfo'][$ak] = $_attach; } } if ($_data['type'] == 'postvideo' && !$var['flashimg']) { $var['flashimg'] = '__THEME__/image/video.png'; } $var['uid'] = $_data['uid']; $var["actor"] = "<a href='{$user['space_url']}' class='name' event-node='face_card' uid='{$user['uid']}'>{$user['uname']}</a>"; $var["actor_uid"] = $user['uid']; $var["actor_uname"] = $user['uname']; $var['feedid'] = $_data['feed_id']; //微吧类型微博用到 // $var["actor_groupData"] = model('UserGroupLink')->getUserGroupData($user['uid']); //需要获取资源信息的微博:所有类型的微博,只要有资源信息就获取资源信息并赋值模版变量,交给模版解析处理 if (!empty($_data['app_row_id'])) { empty($_data['app_row_table']) && ($_data['app_row_table'] = 'feed'); $var['sourceInfo'] = model('Source')->getSourceInfo($_data['app_row_table'], $_data['app_row_id'], false, $_data['app']); $var['sourceInfo']['groupData'] = model('UserGroupLink')->getUserGroupData($var['sourceInfo']['source_user_info']['uid']); } // 解析Feed模版 $feed_template_file = APPS_PATH . '/' . $_data['app'] . '/Conf/' . $_data['type'] . '.feed.php'; if (!file_exists($feed_template_file)) { $feed_template_file = APPS_PATH . '/public/Conf/post.feed.php'; } $feed_xml_content = fetch($feed_template_file, $var); $s = simplexml_load_string($feed_xml_content); if (!$s) { return false; } $result = $s->xpath("//feed[@type='" . t($_data['type']) . "']"); $actions = (array) $result[0]->feedAttr; //输出模版解析后信息 $return["userInfo"] = $user; $return["actor_groupData"] = $var["actor_groupData"]; $return['title'] = trim((string) $result[0]->title); $return['body'] = trim((string) $result[0]->body); // $return['sbody'] = trim((string) $result[0]->sbody); $return['info'] = trim((string) $result[0]['info']); //$return['title'] = parse_html($return['title']); $return['body'] = parse_html($return['body']); $return['api_source'] = $var['sourceInfo']; // $return['sbody'] = parse_html($return['sbody']); $return['actions'] = $actions['@attributes']; //验证转发的原信息是否存在 if (!$this->_notDel($_data['app'], $_data['type'], $_data['app_row_id'])) { $return['body'] = L('PUBLIC_INFO_ALREADY_DELETE_TIPS'); // 此信息已被删除〜 } return $return; }
/** * 渲染评论页面 在addcomment方法中调用 */ public function parseComment($data) { $data['userInfo'] = model('User')->getUserInfo($GLOBALS['ts']['uid']); // 获取用户组信息 $data['userInfo']['groupData'] = model('UserGroupLink')->getUserGroupData($GLOBALS['ts']['uid']); $data['content'] = preg_html($data['content']); $data['content'] = parse_html($data['content']); $data['iscommentdel'] = CheckPermission('core_normal', 'comment_del'); return $this->renderFile(dirname(__FILE__) . "/_parseComment.html", $data); }
/** * 分享给同事 * @example * 需要传入的$data值 * uid:同事用户ID * sid:转发的微博/资源ID * app_name:app名称 * content:转发时的内容信息,有时候会有某些标题的资源 * body:转发时,自定义写入的内容 * type:微博类型 * comment:是否给原作者评论 * @param array $data 分享的相关数据 * @return array 分享操作后,相关反馈信息数据 */ public function shareMessage($data) { $return = array('status' => 0, 'data' => L('PUBLIC_SHARE_FAILED')); // 分享失败 $app = t($data['app_name']); $msg['to'] = trim($data['uids'], ','); if (empty($msg['to'])) { $return['data'] = L('PUBLIC_SHARE_TOUSE_EMPTY'); // 分享接受人不能为空 return $return; } if (!($oldInfo = model('Source')->getSourceInfo($data['type'], $data['sid'], false, $app))) { $return['data'] = L('PUBLIC_INFO_SHARE_FORBIDDEN'); // 此信息不可以被分享 return $return; } $data['content'] = trim($data['content']); $content = empty($data['content']) ? "" : "“{$data['content']}” // "; $content = parse_html($content); $message['to'] = $msg['to']; $message['content'] = $content . parse_html($oldInfo['source_content']) . ' <a href="' . $oldInfo['source_url'] . '" target=\'_blank\'>查看</a>'; if (model('Message')->postMessage($message, $GLOBALS['ts']['_user']['uid'])) { // $config['name'] = $GLOBALS['ts']['_user']['uname']; // $config['content'] = $content; // //$config['sourceurl'] = $oldInfo['source_url']; // $touids = explode(',', $msg['to']); // foreach($touids as $v) { // model('Notify')->sendNotify($v, 'new_message', $config); // } $return = array('status' => 1, 'data' => L('PUBLIC_SHARE_SUCCESS')); // 分享成功 } return $return; }
<?php require "../../app/ajax.php"; // mangler tekst? if (!isset($_POST['text'])) { ajax::text("ERROR:MISSING", ajax::TYPE_INVALID); } global $__server; ajax::essentials(); // logg $name = login::$logged_in ? login::$user->player->data['up_name'] : '*ukjent spiller*'; $ref = isset($_SERVER['HTTP_REFERER']) ? ' - referer: ' . $_SERVER['HTTP_REFERER'] : ' - ingen referer'; putlog("LOG", "%c3%bMIN-STATUS:%b%c %u{$name}%u hentet HTML for BB-kode{$ref}"); // sett opp html $bb = parse_html(game::bb_to_html($_POST['text'])); // send raw html? if (isset($_POST['plain'])) { ajax::text($bb); } // send inni xml element ajax::xml('<content>' . htmlspecialchars($bb) . '</content>');
public function loadMoreShowTalk() { $type = t($_GET['type']); $id = intval($_GET['id']); $sinceId = intval($_GET['since_id']); $toUid = intval($_GET['to_uid']); $maxId = intval($_GET['max_id']); $status = 0; $sinceId = 0; $html = ''; $count = 0; switch ($type) { case 'at': case 'com': $feed = model('Feed')->getFeedInfo($id); $cmap['app'] = $feed['app']; $cmap['table'] = 'feed'; $cmap['row_id'] = $id; // $cmap['comment_id'] = array('ELT', $sinceId); $cmap['comment_id'] = array('EGT', $sinceId); $cmap['_string'] = '( (uid = ' . $this->mid . ' AND to_comment_id = 0) OR (uid = ' . $toUid . ' AND to_comment_id = 0) OR (uid = ' . $this->mid . ' AND to_uid = ' . $toUid . ') OR (uid = ' . $toUid . ' AND to_uid = ' . $this->mid . ') )'; $list = model('Comment')->getCommentList($cmap, 'comment_id ASC', 10); if (!empty($list['data'])) { $status = 1; $sinceId = end($list['data']); $sinceId = $sinceId['comment_id'] + 1; foreach ($list['data'] as $vo) { $html .= '<dl class="msg-dialog" model-node="comment_list">'; $class = $this->mid == $vo['uid'] ? 'right' : 'left'; $html .= '<dt class="' . $class . '">'; $html .= '<a target="_self" href="' . U('public/Profile/index', array('uid' => $vo['uid'])) . '"><img src="' . $vo['user_info']['avatar_tiny'] . '" /></a>'; $html .= '</dt>'; if ($class == 'right') { $html .= '<dd class="dialog-r">'; $html .= '<i class="arrow-mes-r"></i>'; } else { if ($class == 'left') { $html .= '<dd class="dialog-l">'; $html .= '<i class="arrow-mes-l"></i>'; } } if ($vo['is_audit'] == 0 && $vo['uid'] != $this->mid) { $content = '内容正在审核'; } else { $content = str_replace('__THEME__', THEME_PUBLIC_URL, parse_html($vo['content'])); } $html .= '<p class="info">' . getUserSpace($vo['user_info']['uid'], '', $vo['user_info']['uname']) . ':' . $content . '</p>'; $html .= '<p class="date">'; $html .= '<span class="right">'; if ($this->mid == $vo['uid'] && CheckPermission('core_normal', 'comment_del') || CheckPermission('core_admin', 'comment_del')) { $style = ''; if ($vo['uid'] != $this->mid && CheckPermission('core_admin', 'comment_del')) { $style = 'style="color:red;"'; } $html .= '<a href="javascript:;" event-node="comment_del" event-args="comment_id=' . $vo['comment_id'] . '" ' . $style . '>' . L('PUBLIC_STREAM_DELETE') . '</a>'; } if (($vo['uid'] == $mid && CheckPermission('core_normal', 'comment_del') || CheckPermission('core_admin', 'comment_del')) && CheckPermission('core_normal', 'feed_comment')) { $html .= '<i class="vline">|</i>'; } if (CheckPermission('core_normal', 'feed_comment')) { $args = array(); $args[] = 'row_id=' . $vo['row_id']; $args[] = 'app_uid=' . $vo['app_uid']; $args[] = 'to_comment_id=' . $vo['comment_id']; $args[] = 'to_uid=' . $vo['uid']; $args[] = 'to_comment_uname=' . $vo['user_info']['uname']; $args[] = 'app_name=public'; $args[] = 'table=feed'; $html .= '<a href="javascript:;" event-args="' . implode('&', $args) . '" event-node="reply_comment" >回复</a>'; } $html .= '</span>' . friendlyDate($vo['ctime']) . '</p>'; $html .= '</dd>'; $html .= '</dl>'; } } break; case 'pmsg': $list = model('Message')->getMessageByListId($id, $this->mid, $sinceId, $maxId, 10); if (!empty($list['data'])) { $status = 1; $sinceId = $list['since_id']; $maxId = $list['max_id']; foreach ($list['data'] as $vo) { $html .= '<dl class="msg-dialog" model-node="comment_list">'; $class = $this->mid == $vo['from_uid'] ? 'right' : 'left'; $html .= '<dt class="' . $class . '">'; $html .= '<a target="_self" href="' . U('public/Profile/index', array('uid' => $vo['from_uid'])) . '"><img src="' . $vo['user_info']['avatar_tiny'] . '" /></a>'; $html .= '</dt>'; if ($class == 'right') { $html .= '<dd class="dialog-r">'; $html .= '<i class="arrow-mes-r"></i>'; } else { if ($class == 'left') { $html .= '<dd class="dialog-l">'; $html .= '<i class="arrow-mes-l"></i>'; } } $content = str_replace('__THEME__', THEME_PUBLIC_URL, parse_html($vo['content'])); $html .= '<p class="info mb5">' . getUserSpace($vo['user_info']['uid'], '', $vo['user_info']['uname']) . ':' . $content . '</p>'; if ($vo['attach_type'] == 'message_image') { $html .= '<div class="feed_img_lists">'; $html .= '<ul class="small">'; foreach ($vo['attach_infos'] as $v) { $html .= '<li class="left"><a><img src="' . getImageUrl($v['file'], 100, 100, true) . '" width="100" height="100" /></a></li>'; } $html .= '</ul>'; $html .= '</div>'; } else { if ($vo['attach_type'] == 'message_file') { $html .= '<div class="input-content attach-file">'; $html .= '<ul class="feed_file_list">'; foreach ($vo['attach_infos'] as $v) { $html .= '<li><a href="' . U('widget/Upload/down', array('attach_id' => $v['attach_id'])) . '" class="current right" title="下载"><i class="ico-down"></i></a><i class="ico-' . $v['extension'] . '-small"></i><a href="' . U('widget/Upload/down', array('attach_id' => $v['attach_id'])) . '">' . $v['attach_name'] . '</a><span class="tips">(' . byte_format($v['size']) . ')</span></li>'; } $html .= '</ul>'; $html .= '</div>'; } } $html .= '<p class="date">' . friendlyDate($vo['mtime']) . '</p>'; $html .= '</dd>'; $html .= '</dl>'; } } $count = $list['count']; break; } $result['status'] = $status; $result['since_id'] = $sinceId; $result['max_id'] = $maxId; $result['count'] = $count; $result['html'] = $html; exit(json_encode($result)); }
public function notice() { // //获取未读@Me的条数 // $this->assign('unread_atme_count',D('GroupUserCount')->where('uid='.$this->mid." and `key`='unread_atme'")->getField('value')); // 拼装查询条件 $map['uid'] = $this->mid; $map['gid'] = $this->gid; $this->assign('gid', $this->gid); // !empty($_GET['t']) && $map['table'] = t($_GET['t']); if (!empty($_GET['t'])) { $table = t($_GET['t']); switch ($table) { case 'feed': $map['app'] = 'Public'; break; } } // 设置应用名称与表名称 $app_name = isset($_GET['app_name']) ? t($_GET['app_name']) : 'group'; // 获取@Me分享列表 $at_list = D('GroupAtme')->setAppName($app_name)->getAtmeList($map); // dump($at_list);exit; // 添加Widget参数数据 foreach ($at_list['data'] as &$val) { if ($val['source_table'] == 'comment') { $val['widget_sid'] = $val['sourceInfo']['source_id']; $val['widget_style'] = $val['sourceInfo']['source_table']; $val['widget_sapp'] = $val['sourceInfo']['app']; $val['widget_suid'] = $val['sourceInfo']['uid']; $val['widget_share_sid'] = $val['sourceInfo']['source_id']; } else { if ($val['is_repost'] == 1) { $val['widget_sid'] = $val['source_id']; $val['widget_stype'] = $val['source_table']; $val['widget_sapp'] = $val['app']; $val['widget_suid'] = $val['uid']; $val['widget_share_sid'] = $val['app_row_id']; $val['widget_curid'] = $val['source_id']; $val['widget_curtable'] = $val['source_table']; } else { $val['widget_sid'] = $val['source_id']; $val['widget_stype'] = $val['source_table']; $val['widget_sapp'] = $val['app']; $val['widget_suid'] = $val['uid']; $val['widget_share_sid'] = $val['source_id']; } } // 获取转发与评论数目 if ($val['source_table'] != 'comment') { $feedInfo = D('GroupFeed')->get($val['widget_sid']); $val['repost_count'] = $feedInfo['repost_count']; $val['comment_count'] = $feedInfo['comment_count']; } //解析数据成网页端显示格式(@xxx 加链接) $val['source_content'] = parse_html($val['source_content']); } // 获取分享设置 $weiboSet = model('Xdata')->get('admin_Config:feed'); $this->assign($weiboSet); // 用户@Me未读数目重置 D('GroupUserCount')->setGroupZero($this->mid, $this->gid, 'atme', 0); $this->setTitle(L('PUBLIC_MENTION_INDEX')); $userInfo = model('User')->getUserInfo($this->mid); $this->setKeywords('@提到' . $userInfo['uname'] . '的消息'); $this->assign('hashtab', 'atme'); $this->assign($at_list); $this->assign('swich_title', '@提到我的'); $this->assign('is_atme', true); $this->display(); }
/** * Parse innhold etter det er generert og gjør siste endringer * * Legger til meldinger, brukerlenker m.v. * * Legger også til debuginfo * * @param string * @return string */ public function postParse($content) { \ess::$b->dt("postParse start"); // sjekk om betingelsene er oppdatert if (login::$logged_in && login::$user->data['u_tos_version'] != game::$settings['tos_version']['value'] && !defined("TOS_MESSAGE")) { define("TOS_MESSAGE", true); $this->add_message('<b>Betingelser oppdatert -</b> Du har ikke lest gjennom de nyeste <a href="' . ess::$s['rpath'] . '/betingelser">betingelsene</a>! Ditt videre bruk betyr at du samtykker i disse betingelsene.', "error"); } // informasjonsmeldinger $msgs = $this->messages->getBoxes(); if (!preg_match_all("~<boxes( (-?\\d+))? />~", $content, $matches, PREG_SET_ORDER)) { throw new \RuntimeException("Missing boxes-element from template."); } $match = ''; $match_id = null; foreach ($matches as $m) { $id = isset($m[2]) ? (int) $m[2] : 0; if ($match_id === null || $id > $match_id) { $match = $m[0]; } } $content = preg_replace("~" . preg_quote($match, "~") . "~", $msgs, $content, 1); $content = preg_replace("~<boxes( (-?\\d+))? />~", "", $content); // gå gjennom HTML og sjekk for brukerlinker (<user../>) osv. og vis innholdet $content = parse_html($content); if (defined("SHOW_QUERIES_INFO")) { $profiler = \Kofradia\DB::getProfiler(); $db = ''; if ($profiler && count($profiler->statements) > 0) { $statements = $profiler->statements; $x = 0; foreach (array_keys($statements[0]) as $key) { $x = max($x, strlen($key)); } $newlist = array(); foreach ($statements as $statement) { $new = array(); foreach ($statement as $key => $row) { $new[str_pad($key, $x)] = $row; } $newlist[] = $new; } $db = '<br />DATABASE<br />' . htmlspecialchars(print_r($newlist, true)); } $content .= ' <a href="javascript:void(0)" onclick="this.nextSibling.style.display=\'block\'">Debug info</a><div style="display: none"><br /> <pre> GET<br />' . htmlspecialchars(print_r($_GET, true)) . '<br /> POST<br />' . htmlspecialchars(print_r($_POST, true)) . $db . ' </pre> </div>'; } \ess::$b->dt('postParse end'); return $content; }