本文整理汇总了PHP中News::select方法的典型用法代码示例。如果您正苦于以下问题:PHP News::select方法的具体用法?PHP News::select怎么用?PHP News::select使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类News
的用法示例。
在下文中一共展示了News::select方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public function index()
{
$lang = Cookie::get('lang', 'ru');
$leaders = Leadership::select("lead_fio_{$lang}", "lead_post_{$lang}", "lead_text_{$lang}", "lead_photo", "lead_email", "lead_phone")->get();
$news = News::select('news_id', 'news_alias', "news_title_{$lang}", "updated_at")->orderBy('updated_at', 'DESC')->limit(5)->get();
$cookie = Cookie::make('page', 'about_us', 60 * 24 * 180);
$view = View::make('leaders')->with(array('leaders' => $leaders, 'news' => $news, 'lang' => $lang));
return Response::make($view)->withCookie($cookie);
}
示例2: index
public function index()
{
$lang = Cookie::get('lang', 'ru');
Cookie::queue('page', 'home', 60 * 24 * 180);
$projects = Project::select('project_id', 'project_alias', "project_keywords_{$lang}", "project_description_{$lang}", "project_name_{$lang}", "project_text_{$lang}", "project_image_preview", "project_date_start", "project_date_stop", "updated_at")->orderBy('updated_at', 'desc')->limit(3)->get();
$projects_count = Project::count();
$news = News::select('news_id', 'news_alias', "news_title_{$lang}", "updated_at")->orderBy('updated_at', 'DESC')->limit(5)->get();
return View::make('index')->with(array('projects' => $projects, 'projects_count' => $projects_count, 'news' => $news, 'lang' => $lang));
}
示例3: ConsoleOption
* License: http://www.bluethrust.com/license.php
*
*/
include_once "../../../_setup.php";
include_once "../../../classes/member.php";
include_once "../../../classes/rank.php";
include_once "../../../classes/news.php";
// Start Page
$consoleObj = new ConsoleOption($mysqli);
$cID = $consoleObj->findConsoleIDByName("Manage News");
$consoleObj->select($cID);
$member = new Member($mysqli);
$member->select($_SESSION['btUsername']);
$memberInfo = $member->get_info_filtered();
$commentObj = new Basic($mysqli, "comments", "comment_id");
$newsObj = new News($mysqli);
if ($member->authorizeLogin($_SESSION['btPassword']) && $member->hasAccess($consoleObj) && $commentObj->select($_POST['commentID'])) {
$commentInfo = $commentObj->get_info_filtered();
$newsObj->select($commentInfo['news_id']);
$newsInfo = $newsObj->get_info_filtered();
$member->select($commentInfo['member_id']);
$posterInfo = $member->get_info_filtered();
$logMessage = "Deleted comment by " . $member->getMemberLink() . " on news post: <b><a href='" . $MAIN_ROOT . "news/viewpost.php?nID=" . $newsInfo['news_id'] . "'>" . $newsInfo['postsubject'] . "</a></b>";
$member->select($memberInfo['member_id']);
$member->logAction($logMessage);
$commentObj->delete();
$arrComments = $newsObj->getComments();
$commentCount = $newsObj->countComments();
}
include "../../../news/comments.php";
echo "\n\t<script type='text/javascript'>\n\t\t\$(document).ready(function() {\n\t\t\t\$('#commentCount').html('" . $commentCount . "');\n\t\t});\n\t</script>\n";
示例4: ConsoleOption
*
* License: http://www.bluethrust.com/license.php
*
*/
include_once "../../../../_setup.php";
include_once "../../../../classes/member.php";
include_once "../../../../classes/rank.php";
include_once "../../../../classes/news.php";
include_once "../../../../classes/shoutbox.php";
// Start Page
$consoleObj = new ConsoleOption($mysqli);
$cID = $consoleObj->findConsoleIDByName("Manage News");
$consoleObj->select($cID);
$consoleInfo = $consoleObj->get_info_filtered();
$member = new Member($mysqli);
$member->select($_SESSION['btUsername']);
$newsObj = new News($mysqli);
// Check Login
$LOGIN_FAIL = true;
if ($member->authorizeLogin($_SESSION['btPassword']) && $member->hasAccess($consoleObj) && $newsObj->select($_POST['postID'])) {
$newsObj->delete();
$shoutboxObj = new Shoutbox($mysqli, "news", "news_id");
$shoutboxObj->strDivID = filterText($_POST['updateDiv']);
$shoutboxObj->intDispWidth = 140;
$shoutboxObj->intDispHeight = 300;
$shoutboxObj->blnUpdateShoutbox = true;
$shoutboxObj->blnMainShoutbox = true;
$shoutboxObj->strEditLink = $MAIN_ROOT . "members/console.php?cID=" . $cID . "&newsID=";
$shoutboxObj->strDeleteLink = $MAIN_ROOT . "members/include/news/include/deleteshoutpost.php";
echo $shoutboxObj->dispShoutbox();
}
示例5: News
*
* License: http://www.bluethrust.com/license.php
*
*/
if (!isset($member) || substr($_SERVER['PHP_SELF'], -11) != "console.php") {
exit;
} else {
$memberInfo = $member->get_info();
$consoleObj->select($_GET['cID']);
if (!$member->hasAccess($consoleObj)) {
exit;
}
}
$cID = $_GET['cID'];
$newsObj = new News($mysqli);
if (isset($_GET['newsID']) && $newsObj->select($_GET['newsID'])) {
$newsInfo = $newsObj->get_info_filtered();
define("POSTNEWS_FORM", true);
include BASE_DIRECTORY . "members/include/news/postnews_form.php";
$breadcrumbObj->popCrumb();
if ($newsInfo['newstype'] != 3) {
$arrComponents['newstype']['value'] = $newsInfo['newstype'];
$arrComponents['pintohp']['value'] = $newsInfo['hpsticky'];
$arrComponents['subject']['value'] = $newsInfo['postsubject'];
$breadcrumbObj->addCrumb($consoleTitle, $MAIN_ROOT . "members/console.php?cID=" . $cID);
$breadcrumbObj->addCrumb("<b>Edit Post:</b> " . $newsInfo['postsubject']);
} else {
unset($arrComponents['newstype']);
unset($arrComponents['pintohp']);
unset($arrComponents['subject']);
$arrComponents['newspost']['type'] = "textarea";
示例6: ConsoleOption
include_once "../../../../_setup.php";
include_once "../../../../classes/member.php";
include_once "../../../../classes/rank.php";
include_once "../../../../classes/news.php";
include_once "../../../../classes/shoutbox.php";
// Start Page
$consoleObj = new ConsoleOption($mysqli);
$cID = $consoleObj->findConsoleIDByName("Manage Shoutbox Posts");
$consoleObj->select($cID);
$consoleInfo = $consoleObj->get_info_filtered();
$member = new Member($mysqli);
$member->select($_SESSION['btUsername']);
$newsObj = new News($mysqli);
// Check Login
$LOGIN_FAIL = true;
if ($member->authorizeLogin($_SESSION['btPassword']) && $member->hasAccess($consoleObj)) {
$memberInfo = $member->get_info_filtered();
$arrPostIDs = json_decode($_POST['deletePosts'], true);
foreach ($arrPostIDs as $postID) {
if ($newsObj->select($postID) && $newsObj->get_info("newstype") == 3) {
$newsObj->delete();
}
}
$countPosts = count($arrPostIDs);
$addS = $countPosts > 1 ? "s" : "";
$member->logAction("Deleted " . $countPosts . " shoutbox post" . $addS . ".");
define("SHOW_SHOUTBOXLIST", true);
include "manageshoutbox_list.php";
}
?>
示例7: Basic
$prevFolder = "../";
include $prevFolder . "_setup.php";
$ipbanObj = new Basic($mysqli, "ipban", "ipaddress");
if ($ipbanObj->select($IP_ADDRESS, false)) {
$ipbanInfo = $ipbanObj->get_info();
if (time() < $ipbanInfo['exptime'] or $ipbanInfo['exptime'] == 0) {
die("<script type='text/javascript'>window.location = '" . $MAIN_ROOT . "banned.php';</script>");
} else {
$ipbanObj->delete();
}
}
$newsObj = new News($mysqli);
// Start Page
$PAGE_NAME = "News - ";
include $prevFolder . "themes/" . $THEME . "/_header.php";
$breadcrumbObj->setTitle("News");
$breadcrumbObj->addCrumb("Home", $MAIN_ROOT);
$breadcrumbObj->addCrumb("News");
include $prevFolder . "include/breadcrumb.php";
$totalPages = $newsObj->calcPages();
$arrPosts = $newsObj->getPosts();
if (count($arrPosts) > 0) {
foreach ($arrPosts as $post) {
$newsObj->select($post['news_id']);
$newsObj->show();
}
$newsObj->displayPageSelector();
} else {
echo "\n\n\t<div class='shadedBox' style='width: 300px; margin-top: 50px; margin-bottom: 25px; margin-left: auto; margin-right: auto'>\n\t\t<p class='main' align='center'>\n\t\t\t<i>There are currently no news posts!</i>\n\t\t</p>\n\t</div>\n\n\t";
}
include $prevFolder . "themes/" . $THEME . "/_footer.php";
示例8: parseBBCode
$checkHTMLAccess = $member->hasAccess($checkHTMLConsoleObj);
}
$dispNews = $checkHTMLAccess ? parseBBCode($newsObj->get_info("newspost")) : nl2br(parseBBCode(filterText($newsInfo['newspost'])));
$dispAnnouncements .= "\n\t\t\t<div class='newsDiv' id='newsDiv_" . $newsInfo['news_id'] . "'>\n\t\t\t\t<div class='postInfo'>\n\t\t\t\t\t<div id='newsPostAvatar' style='float: left'><img src='" . $posterInfo['avatar'] . "' class='avatarImg'></div>\n\t\t\t\t\t<div id='newsPostInfo' style='float: left; margin-left: 15px'>posted by " . $member->getMemberLink() . " - " . getPreciseTime($newsInfo['dateposted']) . $dispNewsType . "<br>\n\t\t\t\t\t<span class='subjectText'>" . $newsInfo['postsubject'] . "</span></div>\n\t\t\t\t</div>\n\t\t\t\t<br>\n\t\t\t\t<div class='dottedLine' style='margin-top: 5px'></div>\n\t\t\t\t<div class='postMessage'>\n\t\t\t\t\t" . $dispNews . "\n\t\t\t\t</div>\n\t\t\t\t<div class='dottedLine' style='margin-top: 5px; margin-bottom: 5px'></div>\n\t\t\t\t<div class='main' style='margin-top: 0px; margin-bottom: 10px; padding-left: 5px'>" . $dispLastEdit . "</div>\n\t\t\t\t<p style='padding: 0px; margin: 0px' align='right'><b><a href='" . $MAIN_ROOT . "news/viewpost.php?nID=" . $newsInfo['news_id'] . "#comments'>Comments (" . $newsObj->countComments() . ")</a></b></p>\n\t\t\t</div>\n\t\t\n\t\t\n\t\t";
}
}
// Get Most Recent News Post
$numOfNewsPosts = $websiteInfo['hpnews'] == -1 ? "" : " LIMIT " . $websiteInfo['hpnews'];
$result = $mysqli->query("SELECT * FROM " . $dbprefix . "news WHERE newstype = '1' AND hpsticky = '0' ORDER BY dateposted DESC" . $numOfNewsPosts);
$checkHTMLAccess = "";
if ($result->num_rows > 0) {
while ($row = $result->fetch_assoc()) {
unset($checkHTMLAccess);
$newsObj = new News($mysqli);
$newsInfo = filterArray($row);
$newsObj->select($newsInfo['news_id']);
$member->select($newsInfo['member_id']);
$posterInfo = $member->get_info_filtered();
if ($posterInfo['avatar'] == "") {
$posterInfo['avatar'] = $MAIN_ROOT . "themes/" . $THEME . "/images/defaultavatar.png";
}
$dispNewsType = " - <span class='publicNewsColor' style='font-style: italic'>public</span>";
$dispLastEdit = "";
if ($member->select($newsInfo['lasteditmember_id'])) {
$dispLastEditTime = getPreciseTime($newsInfo['lasteditdate']);
$dispLastEdit = "<span style='font-style: italic'>last edited by " . $member->getMemberLink() . " - " . $dispLastEditTime . "</span>";
}
$member->select($newsInfo['member_id']);
if (!isset($checkHTMLAccess)) {
$checkHTMLAccess = $member->hasAccess($checkHTMLConsoleObj);
}
示例9: getData
/** Get the data for each comment
* @return string
* @throws Zend_Exception
* @access public
*/
public function getData()
{
switch ($this->getType()) {
case 'findComment':
$finds = new Finds();
$data = $finds->fetchRow($finds->select()->where('id = ?', $this->getId()));
break;
case 'newsComment':
$news = new News();
$data = $news->fetchRow($news->select()->where('id = ?', $this->getId()));
break;
default:
throw new Zend_Exception('That type of comment is not a choice');
}
return $data;
}
示例10: array
if ($member->authorizeLogin($_SESSION['btPassword']) && ($checkAccess1 || $checkAccess2)) {
$arrTypes = array("news", "tournament", "event");
$arrTypeObj['news']['obj'] = $newsObj;
$arrTypeObj['tournament']['obj'] = $tournamentObj;
$arrTypeObj['event']['obj'] = $eventObj;
$arrTypeObj['news']['title'] = "postsubject";
$arrTypeObj['tournament']['title'] = "name";
$arrTypeObj['event']['title'] = "title";
$arrTypeObj['news']['message'] = "newspost";
$arrTypeObj['tournament']['message'] = "description";
$arrTypeObj['event']['message'] = "description";
if (in_array($_POST['attachtype'], $arrTypes)) {
$checkInfo = false;
switch ($_POST['attachtype']) {
case "news":
$checkInfo = $newsObj->select($_POST['attachID']);
$linkURL = $MAIN_ROOT . "news/viewpost.php?nID=" . $_POST['attachID'];
break;
case "tournament":
$checkInfo = $tournamentObj->select($_POST['attachID']);
$linkURL = $MAIN_ROOT . "tournaments/view.php?tID=" . $_POST['attachID'];
break;
case "event":
$checkInfo = $eventObj->select($_POST['attachID']);
$linkURL = $MAIN_ROOT . "events/info.php?eID=" . $_POST['attachID'];
break;
}
if ($checkInfo) {
$attachObj = $arrTypeObj[$_POST['attachtype']]['obj'];
$attachTitle = $arrTypeObj[$_POST['attachtype']]['title'];
$attachMessage = $arrTypeObj[$_POST['attachtype']]['message'];