403Webshell
Server IP : 156.238.232.47  /  Your IP : 216.73.216.150
Web Server : nginx/1.25.3
System : Linux C202504152095410 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
User : www ( 1000)
PHP Version : 8.3.25
Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /www/data/wwwroot/2026_06_02_05/source/function/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /www/data/wwwroot/2026_06_02_05/source/function/function_feed.php
<?php

/**
 * [Discuz!] (C)2001-2099 Discuz! Team
 * This is NOT a freeware, use is subject to license terms
 * https://license.discuz.vip
 */

if(!defined('IN_DISCUZ')) {
	exit('Access Denied');
}

function feed_add($icon, $title_template = '', $title_data = [], $body_template = '', $body_data = [], $body_general = '', $images = [], $image_links = [], $target_ids = '', $friend = '', $appid = '', $returnid = 0, $id = 0, $idtype = '', $uid = 0, $username = '') {
	global $_G;

	if(!helper_access::check_module('feed')) {
		return false;
	}
	$title_template = $title_template ? lang('feed', $title_template) : '';
	$body_template = $body_template ? lang('feed', $body_template) : '';
	$body_general = $body_general ? lang('feed', $body_general) : '';
	if(empty($uid) || empty($username)) {
		$uid = $username = '';
	}

	$feedarr = [
		'icon' => $icon,
		'uid' => $uid ? intval($uid) : $_G['uid'],
		'username' => $username ? $username : $_G['username'],
		'dateline' => $_G['timestamp'],
		'title_template' => $title_template,
		'body_template' => $body_template,
		'body_general' => $body_general,
		'image_1' => empty($images[0]) ? '' : $images[0],
		'image_1_link' => empty($image_links[0]) ? '' : $image_links[0],
		'image_2' => empty($images[1]) ? '' : $images[1],
		'image_2_link' => empty($image_links[1]) ? '' : $image_links[1],
		'image_3' => empty($images[2]) ? '' : $images[2],
		'image_3_link' => empty($image_links[2]) ? '' : $image_links[2],
		'image_4' => empty($images[3]) ? '' : $images[3],
		'image_4_link' => empty($image_links[3]) ? '' : $image_links[3],
		'target_ids' => $target_ids,
		'friend' => $friend,
		'id' => $id,
		'idtype' => $idtype
	];

	$feedarr['title_data'] = serialize($title_data);
	$feedarr['body_data'] = serialize($body_data);
	$feedarr['hash_data'] = empty($title_data['hash_data']) ? '' : $title_data['hash_data'];

	if($feedarr['hash_data']) {
		$oldfeed = table_home_feed::t()->fetch_feedid_by_hashdata($feedarr['uid'], $feedarr['hash_data']);
		if($oldfeed) {
			return 0;
		}
	}
	$feed_table = 'home_feed';

	return C::t($feed_table)->insert($feedarr, $returnid);
}

function mkfeed($feed, $actors = []) {
	global $_G;
	require_once libfile('function/discuzcode');
	$feed['title_data'] = empty($feed['title_data']) ? [] : (is_array($feed['title_data']) ? $feed['title_data'] : @dunserialize($feed['title_data']));
	if(!is_array($feed['title_data'])) $feed['title_data'] = [];

	$feed['body_data'] = empty($feed['body_data']) ? [] : (is_array($feed['body_data']) ? $feed['body_data'] : @dunserialize($feed['body_data']));
	if(!is_array($feed['body_data'])) $feed['body_data'] = [];
	$searchs = $replaces = [];
	if($feed['title_data']) {
		foreach(array_keys($feed['title_data']) as $key) {
			$searchs[] = '{'.$key.'}';
			$replaces[] = $feed['title_data'][$key];
		}
	}

	$searchs[] = '{actor}';
	$replaces[] = empty($actors) ? "<a href=\"home.php?mod=space&uid={$feed['uid']}\" target=\"_blank\">{$feed['username']}</a>" : implode(lang('core', 'dot'), $actors);
	$feed['title_template'] = str_replace($searchs, $replaces, $feed['title_template']);
	$feed['title_template'] = feed_mktarget($feed['title_template']);

	$searchs = $replaces = [];
	$searchs[] = '{actor}';
	$replaces[] = empty($actors) ? "<a href=\"home.php?mod=space&uid={$feed['uid']}\" target=\"_blank\">{$feed['username']}</a>" : implode(lang('core', 'dot'), $actors);
	if($feed['body_data'] && is_array($feed['body_data'])) {
		foreach(array_keys($feed['body_data']) as $key) {
			$searchs[] = '{'.$key.'}';
			$replaces[] = $feed['body_data'][$key];
		}
	}

	if($feed['body_data']['flashvar']) {
		$feed['body_data']['player'] = parseflv($feed['body_data']['data'], '500', '373');
	}
	if($feed['body_data']['musicvar']) {
		$feed['body_data']['player'] = parseaudio($feed['body_data']['data']);
	}
	if($feed['body_data']['videovar']) {
		$feed['body_data']['player'] = parsemedia('x,500,373', $feed['body_data']['data']);
	}

	$feed['magic_class'] = '';
	if(!empty($feed['body_data']['magic_thunder'])) {
		$feed['magic_class'] = 'magicthunder';
	}

	$feed['body_template'] = str_replace($searchs, $replaces, $feed['body_template']);
	$feed['body_template'] = feed_mktarget($feed['body_template']);

	$feed['body_general'] = feed_mktarget($feed['body_general']);

	$feed['icon_image'] = STATICURL."image/feed/{$feed['icon']}.gif";

	$feed['new'] = 0;
	if($_G['cookie']['home_readfeed'] && $feed['dateline'] + 300 > $_G['cookie']['home_readfeed']) {
		$feed['new'] = 1;
	}

	return $feed;
}

function feed_mktarget($html) {
	global $_G;

	if($html && $_G['setting']['feedtargetblank']) {
		$html = preg_replace("/target\=([\'\"]?)[\w]+([\'\"]?)/i", '', $html);
		$html = preg_replace("/<a(.+?)href=([\'\"]?)([^>\s]+)\\2([^>]*)>/i", '<a href="\\3" target="_blank" \\1 \\4>', $html);
	}
	return $html;
}


function feed_publish($id, $idtype, $add = 0) {
	global $_G;
	$id = intval($id);
	if(empty($id)) {
		return;
	}
	if(!helper_access::check_module('feed')) {
		return false;
	}
	$setarr = [];
	switch($idtype) {
		case 'blogid':
			$value = array_merge(
				table_home_blog::t()->fetch($id),
				table_home_blogfield::t()->fetch($id)
			);
			if($value) {
				if($value['friend'] != 3) {
					$setarr['icon'] = 'blog';
					$setarr['id'] = $value['blogid'];
					$setarr['idtype'] = $idtype;
					$setarr['uid'] = $value['uid'];
					$setarr['username'] = $value['username'];
					$setarr['dateline'] = $value['dateline'];
					$setarr['target_ids'] = $value['target_ids'];
					$setarr['friend'] = $value['friend'];
					$setarr['hot'] = $value['hot'];
					$status = $value['status'];

					$url = "home.php?mod=space&uid={$value['uid']}&do=blog&id={$value['blogid']}";
					if($value['friend'] == 4) {
						$setarr['title_template'] = 'feed_blog_password';
						$setarr['title_data'] = ['subject' => "<a href=\"$url\">{$value['subject']}</a>"];
					} else {
						if($value['pic']) {
							$setarr['image_1'] = pic_cover_get($value['pic'], $value['picflag']);
							$setarr['image_1_link'] = $url;
						}
						$setarr['title_template'] = 'feed_blog_title';
						$setarr['body_template'] = 'feed_blog_body';
						$value['message'] = preg_replace('/&[a-z]+\;/i', '', $value['message']);
						$setarr['body_data'] = [
							'subject' => "<a href=\"$url\">{$value['subject']}</a>",
							'summary' => getstr($value['message'], 150, 0, 0, 0, -1)
						];
					}
				}
			}
			break;
		case 'albumid':
			$key = 1;
			if($id > 0) {
				$query = table_home_pic::t()->fetch_all_by_sql('p.'.DB::field('albumid', $id), 'a.dateline DESC', 0, 4);
				foreach($query as $value) {
					if($value['friend'] <= 2) {
						if(empty($setarr['icon'])) {
							$setarr['icon'] = 'album';
							$setarr['id'] = $value['albumid'];
							$setarr['idtype'] = $idtype;
							$setarr['uid'] = $value['uid'];
							$setarr['username'] = $value['username'];
							$setarr['dateline'] = $value['dateline'];
							$setarr['target_ids'] = $value['target_ids'];
							$setarr['friend'] = $value['friend'];
							$status = $value['status'];
							$setarr['title_template'] = 'feed_album_title';
							$setarr['body_template'] = 'feed_album_body';
							$setarr['body_data'] = [
								'album' => "<a href=\"home.php?mod=space&uid={$value['uid']}&do=album&id={$value['albumid']}\">{$value['albumname']}</a>",
								'picnum' => $value['picnum']
							];
						}
						$setarr['image_'.$key] = pic_get($value['filepath'], 'album', $value['thumb'], $value['remote']);
						$setarr['image_'.$key.'_link'] = "home.php?mod=space&uid={$value['uid']}&do=album&picid={$value['picid']}";
						$key++;
					} else {
						break;
					}
				}
			}
			break;
		case 'picid':
			$plussql = $id > 0 ? 'p.'.DB::field('picid', $id) : 'p.'.DB::field('uid', $_G['uid']).' ORDER BY dateline DESC LIMIT 1';
			$query = table_home_pic::t()->fetch_all_by_sql($plussql);
			if($value = $query[0]) {
				if(empty($value['friend'])) {
					$setarr['icon'] = 'album';
					$setarr['id'] = $value['picid'];
					$setarr['idtype'] = $idtype;
					$setarr['uid'] = $value['uid'];
					$setarr['username'] = $value['username'];
					$setarr['dateline'] = $value['dateline'];
					$setarr['target_ids'] = $value['target_ids'];
					$setarr['friend'] = $value['friend'];
					$setarr['hot'] = $value['hot'];
					$status = $value['status'];
					$url = "home.php?mod=space&uid={$value['uid']}&do=album&picid={$value['picid']}";
					$setarr['image_1'] = pic_get($value['filepath'], 'album', $value['thumb'], $value['remote']);
					$setarr['image_1_link'] = $url;
					$setarr['title_template'] = 'feed_pic_title';
					$setarr['body_template'] = 'feed_pic_body';
					$setarr['body_data'] = ['title' => $value['title']];
				}
			}
			break;
	}

	if($setarr['icon']) {
		$setarr['title_template'] = $setarr['title_template'] ? lang('feed', $setarr['title_template']) : '';
		$setarr['body_template'] = $setarr['body_template'] ? lang('feed', $setarr['body_template']) : '';
		$setarr['body_general'] = $setarr['body_general'] ? lang('feed', $setarr['body_general']) : '';

		$setarr['title_data']['hash_data'] = "{$idtype}{$id}";
		$setarr['title_data'] = serialize($setarr['title_data']);
		$setarr['body_data'] = serialize($setarr['body_data']);

		$feedid = 0;
		if(!$add && $setarr['id']) {
			$feedid = table_home_feed::t()->fetch_feed($id, $idtype);
			$feedid = $feedid['feedid'];
		}
		if($status == 0) {
			if($feedid) {
				table_home_feed::t()->update_feed('', $setarr, '', '', $feedid);
			} else {
				table_home_feed::t()->insert($setarr);
			}
		}
	}

}


Youez - 2016 - github.com/yon3zu
LinuXploit