示例#1
0
$Page = intval(Request('Get', 'page'));
$TotalPage = ceil($Config['NumTags'] / $Config['TopicsPerPage']);
if ($Page < 0 || $Page == 1) {
    header('location: ' . $Config['WebsitePath'] . '/tags');
    exit;
}
if ($Page > $TotalPage) {
    header('location: ' . $Config['WebsitePath'] . 'tags/page/' . $TotalPage);
    exit;
}
if ($Page == 0) {
    $Page = 1;
}
$TagsArray = array();
// UPDATE `carbon_tags` t SET t.Description=(SELECT d.Abstract FROM `carbon_dict` d WHERE d.Title = t.Name limit 1)
if (!$TagsArray) {
    $TagsArray = $DB->query('SELECT * 
		FROM ' . $Prefix . 'tags 
		WHERE IsEnabled=1 
		ORDER BY TotalPosts DESC 
		LIMIT ' . ($Page - 1) * $Config['TopicsPerPage'] . ',' . $Config['TopicsPerPage']);
    if ($CurUserID) {
        $IsFavoriteArray = array_flip($DB->column("SELECT FavoriteID FROM " . $Prefix . "favorites \n\t\t\tWhere UserID=" . $CurUserID . " and Type=2 and FavoriteID in (?)", ArrayColumn($TagsArray, 'ID')));
        //var_dump($IsFavoriteArray);
    }
}
$DB->CloseConnection();
$PageTitle = $Page > 1 ? ' Page' . $Page . '-' : '';
$PageTitle .= $Lang['Hot_Tags'];
$ContentFile = $TemplatePath . 'tags.php';
include $TemplatePath . 'layout.php';
示例#2
0
文件: new.php 项目: npk/Carbon-Forum
     AlertMsg($Lang['Error_Unknown_Referer'], $Lang['Error_Unknown_Referer'], 403);
 }
 if ($TimeStamp - $CurUserInfo['LastPostTime'] <= 5) {
     //发帖至少要间隔5秒
     AlertMsg($Lang['Posting_Too_Often'], $Lang['Posting_Too_Often']);
 }
 $Title = Request('Post', 'Title');
 $Content = Request('Post', 'Content');
 $TagsArray = $_POST['Tag'];
 if ($Title) {
     if (strlen($Title) <= $Config['MaxTitleChars'] || strlen($Content) <= $Config['MaxPostChars']) {
         if (!empty($TagsArray) && !in_array('', $TagsArray) && count($TagsArray) <= $Config["MaxTagsNum"]) {
             //获取已存在的标签
             $TagsExistArray = $DB->query("SELECT ID,Name FROM `" . $Prefix . "tags` WHERE `Name` in (?)", $TagsArray);
             $TagsExist = ArrayColumn($TagsExistArray, 'Name');
             $TagsID = ArrayColumn($TagsExistArray, 'ID');
             //var_dump($TagsExist);
             $NewTags = TagsDiff($TagsArray, $TagsExist);
             //新建不存在的标签
             if ($NewTags) {
                 foreach ($NewTags as $Name) {
                     $DB->query("INSERT INTO `" . $Prefix . "tags` \r\n\t\t\t\t\t\t\t(`ID`, `Name`,`Followers`,`Icon`,`Description`, `IsEnabled`, `TotalPosts`, `MostRecentPostTime`, `DateCreated`) \r\n\t\t\t\t\t\t\tVALUES (?,?,?,?,?,?,?,?,?)", array(null, htmlspecialchars(trim($Name)), 0, 0, null, 1, 1, $TimeStamp, $TimeStamp));
                     $TagsID[] = $DB->lastInsertId();
                 }
                 //更新全站统计数据
                 $NewConfig = array("NumTags" => $Config["NumTags"] + count($NewTags));
                 //var_dump($NewTags);
             }
             $TagsArray = array_merge($TagsExist, $NewTags);
             //往Topics表插入数据
             $TopicData = array("ID" => null, "Topic" => htmlspecialchars($Title), "Tags" => implode("|", $TagsArray), "UserID" => $CurUserID, "UserName" => $CurUserName, "LastName" => "", "PostTime" => $TimeStamp, "LastTime" => $TimeStamp, "IsGood" => 0, "IsTop" => 0, "IsLocked" => 0, "IsDel" => 0, "IsVote" => 0, "Views" => 0, "Replies" => 0, "Favorites" => 0, "RatingSum" => 0, "TotalRatings" => 0, "LastViewedTime" => 0, "PostsTableName" => null, "ThreadStyle" => "", "Lists" => "", "ListsTime" => $TimeStamp, "Log" => "");
示例#3
0
echo $Config['MaxTitleChars'];
?>
;//主题标题最多字节数
	var MaxPostChars = <?php 
echo $Config['MaxPostChars'];
?>
;//主题内容最多字节数
	loadScript("<?php 
echo $Config['WebsitePath'];
?>
/static/js/mobile.new.function.js?version=<?php 
echo $Config['Version'];
?>
", function() {
		$.each(<?php 
echo json_encode(ArrayColumn($HotTagsArray, 'Name'));
?>
,function(Offset,TagName) {
			TagsListAppend(TagName, Offset);
		});
	});
</script>
<form name="NewForm">
	<input type="hidden" name="FormHash" value="<?php 
echo $FormHash;
?>
" />
	<input type="hidden" name="ContentHash" value="" />
	<p><input type="text" name="Title" id="Title" value="<?php 
echo htmlspecialchars($Title);
?>
示例#4
0
<?php

require dirname(__FILE__) . '/common.php';
require dirname(__FILE__) . '/language/' . ForumLanguage . '/favorite_users.php';
Auth(1);
$Page = intval(Request('Get', 'page'));
if ($Page < 0 || $Page == 1) {
    header('location: ' . $Config['WebsitePath'] . '/users/following');
    exit;
}
if ($Page == 0) {
    $Page = 1;
}
$UsersFollowing = array();
$UsersFollowing = $DB->query('SELECT * FROM ' . $Prefix . 'favorites force index(UsersFavorites) Where UserID=? and Type=3', array($CurUserID));
$PostsArray = array();
if ($UsersFollowing) {
    $PostsArray = $DB->query('SELECT * FROM ' . $Prefix . 'posts force index(UserPosts) Where UserName in (?) and IsDel=0 ORDER BY PostTime DESC LIMIT ' . ($Page - 1) * $Config['PostsPerPage'] . ',' . $Config['PostsPerPage'], ArrayColumn($UsersFollowing, 'Title'));
}
$DB->CloseConnection();
$PageTitle = $Lang['My_Following_Users'];
$PageTitle .= $Page > 1 ? ' Page' . $Page : '';
$ContentFile = $TemplatePath . 'favorite_users.php';
include $TemplatePath . 'layout.php';
示例#5
0
<?php

require __DIR__ . '/common.php';
require __DIR__ . '/language/' . ForumLanguage . '/favorite_tags.php';
Auth(1);
$Page = Request('Get', 'page');
if ($Page < 0 || $Page == 1) {
    header('location: ' . $Config['WebsitePath'] . '/tags/following');
    exit;
}
if ($Page == 0) {
    $Page = 1;
}
$TagsFollowing = $DB->query('SELECT * FROM ' . $Prefix . 'favorites force index(UsersFavorites) Where UserID=? and Type=2', array($CurUserID));
$TopicIDArray = array();
if ($TagsFollowing) {
    $TopicIDArray = $DB->column('SELECT TopicID FROM ' . $Prefix . 'posttags force index(TagsIndex) Where TagID in (?) ORDER BY TopicID DESC LIMIT ' . ($Page - 1) * $Config['TopicsPerPage'] . ',' . $Config['TopicsPerPage'], ArrayColumn($TagsFollowing, 'FavoriteID'));
}
array_unique($TopicIDArray);
$TopicsArray = array();
if ($TopicIDArray) {
    $TopicsArray = $DB->query('SELECT `ID`, `Topic`, `Tags`, `UserID`, `UserName`, `LastName`, `LastTime`, `Replies` FROM ' . $Prefix . 'topics force index(PRI) Where ID in (?) and IsDel=0 ORDER BY LastTime DESC', $TopicIDArray);
}
$DB->CloseConnection();
$PageTitle = $Lang['My_Following_Tags'];
$PageTitle .= $Page > 1 ? ' Page' . $Page : '';
$ContentFile = $TemplatePath . 'favorite_tags.php';
include $TemplatePath . 'layout.php';