本文整理汇总了PHP中Board类的典型用法代码示例。如果您正苦于以下问题:PHP Board类的具体用法?PHP Board怎么用?PHP Board使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Board类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
/**
* @see EventListener::execute()
*/
public function execute($eventObj, $className, $eventName)
{
if ($eventObj->poll->messageType == 'post') {
// check permissions
require_once WBB_DIR . 'lib/data/post/Post.class.php';
$post = new Post($eventObj->poll->messageID);
if (!$post->postID) {
throw new IllegalLinkException();
}
require_once WBB_DIR . 'lib/data/thread/Thread.class.php';
$thread = new Thread($post->threadID);
$thread->enter();
require_once WBB_DIR . 'lib/data/board/Board.class.php';
$board = new Board($thread->boardID);
$eventObj->canVotePoll = $board->getPermission('canVotePoll');
// plug in breadcrumbs
WCF::getTPL()->assign(array('board' => $board, 'thread' => $thread, 'showThread' => true));
WCF::getTPL()->append('specialBreadCrumbs', WCF::getTPL()->fetch('navigation'));
// get other polls from this thread
if ($thread->polls > 1) {
require_once WCF_DIR . 'lib/data/message/poll/Poll.class.php';
$polls = array();
$sql = "SELECT \t\tpoll_vote.pollID AS voted,\n\t\t\t\t\t\t\tpoll_vote.isChangeable,\n\t\t\t\t\t\t\tpoll.*\n\t\t\t\t\tFROM \t\twcf" . WCF_N . "_poll poll\n\t\t\t\t\tLEFT JOIN \twcf" . WCF_N . "_poll_vote poll_vote\n\t\t\t\t\tON \t\t(poll_vote.pollID = poll.pollID\n\t\t\t\t\t\t\t" . (!WCF::getUser()->userID ? "AND poll_vote.ipAddress = '" . escapeString(WCF::getSession()->ipAddress) . "'" : '') . "\n\t\t\t\t\t\t\tAND poll_vote.userID = " . WCF::getUser()->userID . ")\n\t\t\t\t\tWHERE \t\tpoll.pollID IN (\n\t\t\t\t\t\t\t\tSELECT\tpollID\n\t\t\t\t\t\t\t\tFROM\twbb" . WBB_N . "_post\n\t\t\t\t\t\t\t\tWHERE\tthreadID = " . $thread->threadID . "\n\t\t\t\t\t\t\t\t\tAND isDeleted = 0\n\t\t\t\t\t\t\t\t\tAND isDisabled = 0\n\t\t\t\t\t\t\t\t\tAND pollID <> 0\n\t\t\t\t\t\t\t)\n\t\t\t\t\tORDER BY\tpoll.question";
$result = WCF::getDB()->sendQuery($sql);
while ($row = WCF::getDB()->fetchArray($result)) {
$polls[] = new Poll(null, $row, $eventObj->canVotePoll);
}
if (count($polls) > 1) {
WCF::getTPL()->assign(array('polls' => $polls, 'pollID' => $eventObj->pollID));
WCF::getTPL()->append('additionalSidebarContent', WCF::getTPL()->fetch('pollOverviewSidebar'));
}
}
}
}
示例2: build
/**
* @param Board $board
* @param int $depth
*/
protected function build(Board $board, $depth)
{
$weight = $this->getPrecedence();
$indent = $board->indent($depth);
$operator = $this->getName();
$index = 0;
/* @var $child Node */
foreach ($this->getChildren() as $child) {
// Prep
$wrap = $child->getPrecedence() < $weight;
// Indent
if ($this->isBlock()) {
$index && $board->write("\n");
$board->write($indent);
}
// Operator
if ($index) {
$board->write($this->isBlock() ? '' : ' ');
$board->write($operator);
$board->write($child->isBlock() && !$wrap ? '' : ' ');
}
// Child:
$wrap && $board->write("(");
$child->isBlock() && $board->write("\n");
// ---
$child->build($board, $depth + 1);
// ---
$wrap && $board->write(")");
// ===
$index++;
}
}
示例3: build
/**
* @param Board $board
* @param int $depth
*/
protected function build(Board $board, $depth)
{
$board->write('INSERT INTO ');
$this->table->build($board, $depth + 1);
$board->write(" (");
$this->columns->build($board, $depth + 1);
$board->write(")\n");
$this->data->build($board, $depth + 1);
}
示例4: build
/**
* @param Board $board
* @param int $depth
*/
protected function build(Board $board, $depth = 0)
{
$resolve = $board->getResolve();
$sql = $resolve ? $this->toSql($board) : '?';
$board->write($sql);
if (!$resolve) {
$board->add($this->getValue());
}
}
示例5: IndexGuncelToHTML
public function IndexGuncelToHTML()
{
$myDBConnector = new DBConnector();
$dbARY = $myDBConnector->infos();
$connection = new mysqli($dbARY[0], $dbARY[1], $dbARY[2], $dbARY[3]);
$connection->set_charset("utf8");
echo "<div style=\"margin:2%;background-color:#e6e6e6;border-bottom:1px solid #c7d0d5;\">";
echo "<p style=\"font-size:20px;word-wrap:break-word;color:#cb7c7a;font-family: 'Josefin Sans', sans-serif;\">";
echo "Güncel panolar";
echo "</p>";
echo "</div>";
echo "<div style=\"\">";
$results = $connection->query("SELECT * FROM boards ORDER BY boardID DESC LIMIT 6 OFFSET 0");
while ($boardInfos = $results->fetch_assoc()) {
$myBoard = new Board(array($boardInfos['boardID'], $boardInfos['boardName'], $boardInfos['boardCategory'], $boardInfos['boardCreator'], $boardInfos['boardImage'], $boardInfos['boardDate']));
$myBoard->BoardToPetitHTML();
}
echo "</div>";
echo "<div id=\"x\" style=\"margin:2%;background-color:#e6e6e6;border-bottom:1px solid #c7d0d5;\">";
echo "<p style=\"font-size:20px;word-wrap:break-word;color:#cb7c7a;font-family: 'Josefin Sans', sans-serif;\">";
echo "Güncel içerikler";
echo "</p>";
echo "</div>";
echo "<div style=\"\">";
if (!$connection->connect_error) {
$results = $connection->query("SELECT * FROM threads ORDER BY threadID DESC LIMIT 12 OFFSET 0 ");
while ($curres = $results->fetch_assoc()) {
$threadID5 = $curres["threadID"];
$threadDate5 = $curres["threadDate"];
$threadWriter5 = $curres["threadWriter"];
$threadCategory5 = $curres["threadCategory"];
$threadPicture5 = $curres["threadPicture"];
$stepCount5 = $curres["stepCount"];
$threadName5 = $curres["threadName"];
$threadPoint5 = $curres["threadPoint"];
$myThread5 = new Thread(array($threadID5, $threadDate5, $threadWriter5, $threadCategory5, $threadPicture5, $stepCount5, $threadName5, $threadPoint5));
$myThread5->ThreadToPetitHTML();
}
echo "<div id=\"moreBestDiv\"></div>";
echo "<div style=\"\">";
echo "<form id=\"loadMoreBestForm\" method=\"post\" action=\"loadMoreRecentIndex.php\">";
echo "<input id=\"loadMoreBestOffset\" name=\"loadMoreBestOffset\" style=\"display:none;\" value=\"" . $results->num_rows . "\"/>";
echo "<button id=\"loadMoreBestButton\" class=\"btn btn-block btn-success\">";
echo "<i id=\"loadMoreBestSpinner\" style=\"display:none;\" class=\"fa fa-refresh fa-spin\"></i>";
echo "<span id=\"loadMoreBestTXT\">";
echo "Daha fazla göster";
echo "</span>";
echo "</button>";
echo "</form>";
echo "</div>";
}
echo "</div>";
echo "<script type=\"text/javascript\">";
echo "\n\t\t\t\$(window).scroll(function(){\n\t\t\t\tvar p = \$('#x');\n\t\t\t\tvar pos = p.position();\n\t\t\t\tvar windowpos = \$(window).scrollTop();\n\t\t\t\tif (windowpos >= pos.top) {\n\t\t\t\t\t\$('#indexStickyFooter').fadeIn(500);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\t\$('#indexStickyFooter').fadeOut(500);\n\t\t\t});\n\t\t\t\$('#loadMoreBestButton').click(function(e){\n\t\t\t\te.preventDefault();\n\t\t\t\t\$('#loadMoreBestTXT').hide();\n\t\t\t\t\$('#loadMoreBestSpinner').show();\n\t\t\t\t\$('#loadMoreBestForm').ajaxForm({\n\t\t\t\t\tsuccess : function(msg){\n\t\t\t\t\t\t\$('#loadMoreBestTXT').show();\n\t\t\t\t\t\t\$('#loadMoreBestSpinner').hide();\n\t\t\t\t\t\tnewoffset = msg.charAt(0);\n\t\t\t\t\t\toldoffset = \$('#loadMoreBestOffset').val();\n\t\t\t\t\t\toldint = parseInt(oldoffset);\n\t\t\t\t\t\tnewint = parseInt(newoffset);\n\t\t\t\t\t\tif (newint==0)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\$('#loadMoreBestTXT').html(\"Hepsi yüklendi\");\n\t\t\t\t\t\t\t\$('#loadMoreBestButton').attr(\"disabled\",true);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\$('#loadMoreBestOffset').val(oldint+newint);\n\t\t\t\t\t\tmsg2 = msg.substring(1);\n\t\t\t\t\t\t\$('#moreBestDiv').append(msg2);\n\t\t\t\t\t},\n\t\t\t\t\terror : function(){\n\n\t\t\t\t\t}\n\t\t\t\t}).submit();\n\t\t\t});\t\n\t\t";
echo "</script>";
}
示例6: addBoard
public function addBoard()
{
try {
$db = new DB();
$board = new Board($_POST["name"], $_POST["description"], $_GET["user"]);
$sql = "INSERT INTO board(name,description,owner_id) VALUES (:name,:description,:owner_id)";
$q = $db->getConnection()->prepare($sql);
$q->execute(array(':name' => $board->getName(), ':description' => $board->getDescription(), ':owner_id' => $board->getOwnerId()));
} catch (PDOException $e) {
echo $e->getMessage();
}
}
示例7: build
/**
* @param Board $board
* @param int $depth
*/
protected function build(Board $board, $depth)
{
$board->write('DELETE FROM ');
$this->table->build($board, $depth + 1);
$where = $this->where;
if ($where) {
$board->write("\n");
$board->write('WHERE');
$board->write($where->isBlock() ? "\n" : " ");
$where->build($board, $depth + 1);
}
}
示例8: writePins
function writePins(array $rgb)
{
static $pi, $r, $g, $b;
if ($pi === null) {
$pi = new Board();
$r = $pi->getPin(0)->mode(Pin::SOFT_PWM_OUT)->softPwmWrite(100);
$g = $pi->getPin(1)->mode(Pin::SOFT_PWM_OUT);
$b = $pi->getPin(2)->mode(Pin::SOFT_PWM_OUT);
}
$r->softPwmWrite($rgb[0]);
$g->softPwmWrite($rgb[1]);
$b->softPwmWrite($rgb[2]);
}
示例9: test5x6Game
public function test5x6Game()
{
$bombs = [new Point(2, 2), new Point(2, 3), new Point(4, 5)];
$settings = new Settings(['length' => 5, 'width' => 6, 'bombs' => count($bombs)]);
$board = new Board($settings);
$board->initBombs($bombs);
$game = new Game($board);
ob_start();
$game->play(__DIR__ . '/resources/5x6_game_input.txt');
$output = ob_get_clean();
$expectedOutput = file_get_contents(__DIR__ . '/resources/5x6_game_expected_output.txt');
$this->assertEquals($expectedOutput, $output);
}
示例10: execute
/**
* @see EventListener::execute()
*/
public function execute($eventObj, $className, $eventName)
{
if ($eventName == 'init') {
$eventObj->sqlSelects .= 'wbb_user.posts,';
$eventObj->sqlJoins .= ' LEFT JOIN wbb' . WBB_N . '_user wbb_user
ON (wbb_user.userID = user.userID) ';
} else {
if ($eventName == 'assignVariables') {
$user = $eventObj->frame->getUser();
$eventObj->generalInformation[] = array('icon' => StyleManager::getStyle()->getIconPath('postM.png'), 'title' => WCF::getLanguage()->get('wcf.user.posts'), 'value' => '<a href="index.php?form=Search&types[]=post&userID=' . $user->userID . SID_ARG_2ND . '" title="' . WCF::getLanguage()->get('wcf.user.profile.search', array('$username' => StringUtil::encodeHTML($user->username))) . '">' . StringUtil::formatInteger(intval($user->posts)) . ($user->getProfileAge() > 1 ? ' ' . WCF::getLanguage()->get('wcf.user.postsPerDay', array('$posts' => StringUtil::formatDouble($user->posts / $user->getProfileAge()))) : '') . '</a>');
// show last 5 posts
if (PROFILE_SHOW_LAST_POSTS) {
require_once WBB_DIR . 'lib/data/post/ViewablePost.class.php';
require_once WBB_DIR . 'lib/data/board/Board.class.php';
$boardIDArray = Board::getAccessibleBoardIDArray(array('canViewBoard', 'canEnterBoard', 'canReadThread'));
if (count($boardIDArray)) {
$posts = array();
$sql = "SELECT\t\tpost.postID, post.time,\n\t\t\t\t\t\t\t\tCASE WHEN post.subject <> '' THEN post.subject ELSE thread.topic END AS subject\n\t\t\t\t\t\tFROM\t\twbb" . WBB_N . "_user_last_post user_last_post\n\t\t\t\t\t\tLEFT JOIN\twbb" . WBB_N . "_post post\n\t\t\t\t\t\tON\t\t(post.postID = user_last_post.postID)\n\t\t\t\t\t\tLEFT JOIN\twbb" . WBB_N . "_thread thread\n\t\t\t\t\t\tON\t\t(thread.threadID = post.threadID)\n\t\t\t\t\t\tWHERE\t\tuser_last_post.userID = " . $user->userID . "\n\t\t\t\t\t\t\t\tAND post.isDeleted = 0\n\t\t\t\t\t\t\t\tAND post.isDisabled = 0\n\t\t\t\t\t\t\t\tAND thread.boardID IN (" . implode(',', $boardIDArray) . ")\n\t\t\t\t\t\t\t\t" . (count(WCF::getSession()->getVisibleLanguageIDArray()) ? "AND thread.languageID IN (" . implode(',', WCF::getSession()->getVisibleLanguageIDArray()) . ")" : "") . "\n\t\t\t\t\t\tORDER BY\tuser_last_post.time DESC";
$result = WCF::getDB()->sendQuery($sql, 5);
while ($row = WCF::getDB()->fetchArray($result)) {
$posts[] = new ViewablePost(null, $row);
}
if (count($posts)) {
WCF::getTPL()->assign(array('posts' => $posts, 'user' => $user));
WCF::getTPL()->append('additionalContent2', WCF::getTPL()->fetch('userProfileLastPosts'));
}
}
}
}
}
}
示例11: readPosts
/**
* Gets the posts for the feed.
*/
protected function readPosts()
{
// accessible boards
$accessibleBoardIDArray = Board::getAccessibleBoardIDArray(array('canViewBoard', 'canEnterBoard', 'canReadThread'));
if (!count($accessibleBoardIDArray)) {
throw new PermissionDeniedException();
}
// get posts
$attachmentPostIDArray = array();
$sql = "SELECT\t\tpost.*\n\t\t\tFROM\t\twbb" . WBB_N . "_post post\n\t\t\tWHERE\t\tpost.threadID IN (" . implode(',', $this->threadIDArray) . ")\n\t\t\t\t\tAND post.threadID IN (SELECT threadID FROM wbb" . WBB_N . "_thread WHERE boardID IN (" . implode(',', $accessibleBoardIDArray) . "))\n\t\t\t\t\tAND post.isDeleted = 0\n\t\t\t\t\tAND post.isDisabled = 0\n\t\t\t\t\t" . ($this->hours ? "AND post.time > " . (TIME_NOW - $this->hours * 3600) : '') . "\n\t\t\tORDER BY\tpost.time DESC";
$result = WCF::getDB()->sendQuery($sql, $this->limit);
while ($row = WCF::getDB()->fetchArray($result)) {
$this->posts[] = new FeedPost(null, $row);
// attachments
if ($row['attachments'] != 0) {
$attachmentPostIDArray[] = $row['postID'];
}
}
// read attachments
if (MODULE_ATTACHMENT == 1 && count($attachmentPostIDArray) > 0 && (WCF::getUser()->getPermission('user.board.canViewAttachmentPreview') || WCF::getUser()->getPermission('user.board.canDownloadAttachment'))) {
require_once WCF_DIR . 'lib/data/attachment/MessageAttachmentList.class.php';
$attachmentList = new MessageAttachmentList($attachmentPostIDArray, 'post');
$attachmentList->readObjects();
$attachments = $attachmentList->getSortedAttachments();
// set embedded attachments
require_once WCF_DIR . 'lib/data/message/bbcode/AttachmentBBCode.class.php';
AttachmentBBCode::setAttachments($attachments);
}
}
示例12: run
public function run()
{
$faker = Faker\Factory::create();
for ($i = 0; $i < 70; $i++) {
$user = User::where('roles', 'applicant')->get()->shuffle()->first();
$board = null;
while (null == $board) {
$day_type = array('internal' => self::INTERNAL_DAYS, 'external' => self::EXTERNAL_DAYS, 'union' => self::UNION_DAYS);
$type = $faker->randomElement(['internal', 'external', 'union']);
$days = $day_type[$type] - 1;
$from = date_format($faker->dateTimeBetween('-3 months', '+3 months'), 'Y-m-d');
$end = date('Y-m-d', strtotime("{$from} + {$days} days"));
$board = Board::where('type', '!=', 'large')->isEmpty($from, $end)->get()->shuffle()->first();
}
ApplyRecord::create(array('board_id' => $board->id, 'user_id' => $user->id, 'event_name' => $faker->company(), 'event_type' => $type, 'post_from' => $from, 'post_end' => $end));
}
for ($i = 0; $i < 30; $i++) {
$user = User::where('roles', 'applicant')->get()->shuffle()->first();
$board = null;
while (null == $board) {
$type = $faker->randomElement(['internal', 'external', 'union']);
$days = self::LARGE_POSTER_DAYS - 1;
$from = date_format($faker->dateTimeBetween('-3 months', '+3 months'), 'Y-m-d');
$end = date('Y-m-d', strtotime("{$from} + {$days} days"));
$board = Board::where('type', 'large')->isEmpty($from, $end)->get()->shuffle()->first();
}
ApplyRecord::create(array('board_id' => $board->id, 'user_id' => $user->id, 'event_name' => $faker->company(), 'event_type' => $type, 'post_from' => $from, 'post_end' => $end));
}
}
示例13: getObjectByID
/**
* @see WarningObjectType::getObjectByID()
*/
public function getObjectByID($objectID)
{
if (is_array($objectID)) {
$posts = array();
$sql = "SELECT\t\tpost.*, thread.topic, thread.boardID\n\t\t\t\tFROM \t\twbb" . WBB_N . "_post post\n\t\t\t\tLEFT JOIN\twbb" . WBB_N . "_thread thread\n\t\t\t\tON\t\t(thread.threadID = post.threadID)\n\t\t\t\tWHERE \t\tpostID IN (" . implode(',', $objectID) . ")";
$result = WCF::getDB()->sendQuery($sql);
while ($row = WCF::getDB()->fetchArray($result)) {
$posts[$row['postID']] = new PostWarningObject(null, $row);
}
return count($posts) > 0 ? $posts : null;
} else {
// get object
$post = new PostWarningObject($objectID);
if (!$post->postID) {
return null;
}
// check permissions
if (!class_exists('WBBACP')) {
// ignore permission in acp
$board = Board::getBoard($post->boardID);
if (!$board->getPermission('canViewBoard') || !$board->getPermission('canEnterBoard')) {
return null;
}
}
// return object
return $post;
}
}
示例14: getObjectsByTagID
/**
* @see Taggable::getObjectsByTagID()
*/
public function getObjectsByTagID($tagID, $limit = 0, $offset = 0)
{
$accessibleBoardIDArray = Board::getAccessibleBoardIDArray();
if (count($accessibleBoardIDArray) == 0) {
return array();
}
$sqlThreadVisitSelect = $sqlThreadVisitJoin = $sqlSubscriptionSelect = $sqlSubscriptionJoin = $sqlOwnPostsSelect = $sqlOwnPostsJoin = '';
if (WCF::getUser()->userID != 0) {
$sqlThreadVisitSelect = ', thread_visit.lastVisitTime';
$sqlThreadVisitJoin = " LEFT JOIN \twbb" . WBB_N . "_thread_visit thread_visit \n\t\t\t\t\t\tON \t\t(thread_visit.threadID = thread.threadID\n\t\t\t\t\t\t\t\tAND thread_visit.userID = " . WCF::getUser()->userID . ")";
$sqlSubscriptionSelect = ', IF(thread_subscription.userID IS NOT NULL, 1, 0) AS subscribed';
$sqlSubscriptionJoin = " LEFT JOIN \twbb" . WBB_N . "_thread_subscription thread_subscription \n\t\t\t\t\t\tON \t\t(thread_subscription.userID = " . WCF::getUser()->userID . "\n\t\t\t\t\t\t\t\tAND thread_subscription.threadID = thread.threadID)";
if (BOARD_THREADS_ENABLE_OWN_POSTS) {
$sqlOwnPostsSelect = "DISTINCT post.userID AS ownPosts,";
$sqlOwnPostsJoin = "\tLEFT JOIN\twbb" . WBB_N . "_post post\n\t\t\t\t\t\t\tON \t\t(post.threadID = thread.threadID\n\t\t\t\t\t\t\t\t\tAND post.userID = " . WCF::getUser()->userID . ")";
}
}
$threads = array();
$sql = "SELECT\t\t" . $sqlOwnPostsSelect . "\n\t\t\t\t\tthread.*,\n\t\t\t\t\tboard.boardID, board.title\n\t\t\t\t\t" . $sqlThreadVisitSelect . "\n\t\t\t\t\t" . $sqlSubscriptionSelect . "\n\t\t\tFROM\t\twcf" . WCF_N . "_tag_to_object tag_to_object\n\t\t\tLEFT JOIN\twbb" . WBB_N . "_thread thread\n\t\t\tON\t\t(thread.threadID = tag_to_object.objectID)\n\t\t\tLEFT JOIN \twbb" . WBB_N . "_board board\n\t\t\tON \t\t(board.boardID = thread.boardID)\n\t\t\t" . $sqlOwnPostsJoin . "\n\t\t\t" . $sqlThreadVisitJoin . "\n\t\t\t" . $sqlSubscriptionJoin . "\n\t\t\tWHERE\t\ttag_to_object.tagID = " . $tagID . "\n\t\t\t\t\tAND tag_to_object.taggableID = " . $this->getTaggableID() . "\n\t\t\t\t\tAND thread.boardID IN (" . implode(',', $accessibleBoardIDArray) . ")\n\t\t\t\t\tAND thread.isDeleted = 0\n\t\t\t\t\tAND thread.isDisabled = 0\n\t\t\tORDER BY\tthread.lastPostTime DESC";
$result = WCF::getDB()->sendQuery($sql, $limit, $offset);
while ($row = WCF::getDB()->fetchArray($result)) {
$row['taggable'] = $this;
$threads[] = new TaggedThread(null, $row);
}
return $threads;
}
示例15: run
public function run()
{
$faker = Faker::create();
foreach (range(1, 10) as $index) {
Board::create([]);
}
}