示例#1
0
function process_main($window, $id)
{
    global $label, $statusbar, $top_bar, $foot_bar, $news_str, $wb;
    static $pos, $top_pos, $foot_pos;
    $disks_str = "";
    $news_str = $wb->newscontent;
    //	if ((date("i")%3)==0)
    //	{
    //		$news_str="滚动新闻:".getNews ();
    //
    ////		$disks = explode(" ", wb_get_system_info("diskdrives"));
    ////		for ($index = 0; $index < sizeof($disks); $index++)
    ////		{
    ////			$disks_str .= getTotalDiskSpace ($disks[$index]);
    ////		}
    //
    //	}
    //	$news_str=$news_str?$news_str:"滚动新闻:".getNews ();
    switch ($id) {
        case ID_NEWS_TIMER:
            $wb->newscontent = getNews();
            break;
        case ID_APP_TIMER:
            // Show the current time in hours, minutes and seconds
            wb_set_text($label, getTimeShotFormat(date("h:i:s A")));
            // Truncate text
            $text = $news_str;
            //			$text = formatLocalDate (date("Y-m-d H:i:s")).$news_str;//.$news_str;//date(LONG_FMT);
            $len = strlen($text);
            wb_set_text($statusbar, mb_substr($text . $text, $pos, $len, "gb2312"));
            //substr($text . $text, $pos, $len) mb_substr($text . $text, $pos, $len,"gb2312")
            $pos = $pos < $len ? $pos + 2 : 0;
            $top_text = "....>........";
            if (ereg("11:4([0-9])", date("H:i"))) {
                $top_text = "吃中午饭时间";
            }
            if (ereg("12:([0-9]{2})", date("H:i"))) {
                $top_text = "中午休息时间";
            }
            if (ereg("17:([2-3][0-9])", date("H:i"))) {
                $top_text = "记得写每日工作报告";
            }
            $top_len = strlen($top_text);
            wb_set_text($top_bar, mb_substr($top_text . $top_text, $top_pos, $top_len, "gb2312"));
            //substr($text . $text, $pos, $len) mb_substr($text . $text, $pos, $len,"gb2312")
            $top_pos = $top_pos > 0 ? $top_pos - 1 : $top_len;
            //			$foot_len = strlen($disks_str);
            //			wb_set_text($foot_bar, mb_substr($disks_str . $disks_str, $foot_pos, $foot_len,"gb2312"));//substr($text . $text, $pos, $len) mb_substr($text . $text, $pos, $len,"gb2312")
            //			$foot_pos = $foot_pos < $foot_len  ? $foot_pos +1 : 0;
            break;
        case IDCLOSE:
            wb_destroy_window($window);
            break;
    }
}
* see license.txt file; if not, write to marketing@boonex.com
***************************************************************************/
require_once 'inc/header.inc.php';
require_once BX_DIRECTORY_PATH_INC . 'design.inc.php';
require_once BX_DIRECTORY_PATH_INC . 'news.inc.php';
require_once BX_DIRECTORY_PATH_INC . 'profiles.inc.php';
require_once BX_DIRECTORY_PATH_INC . 'utils.inc.php';
// --------------- page variables / login
$_page['name_index'] = 20;
$_page['css_name'] = 'news.css';
$logged['member'] = member_auth(0, false);
$_page['header'] = _t("_NEWS_H");
$_page['header_text'] = _t("_NEWS_H");
// --------------- page components
$_ni = $_page['name_index'];
$_page_cont[$_ni]['page_main_code'] = isset($_GET['ID']) || isset($_GET['newsUri']) ? getNews() : printNewsList();
// --------------- [END] page components
PageCode();
// --------------- page components functions
/**
 * Print news
 */
function printNewsList()
{
    global $news_limit_chars;
    global $short_date_format;
    global $tmpl;
    $bNewsFriendly = getParam('permalinks_news') == 'on' ? true : false;
    $res = getNewsList();
    ob_start();
    if (!mysql_num_rows($res)) {
示例#3
0
 function _Comment_delete()
 {
     if (!$this->userdata['rights']['news']) {
         $this->_header("index.php");
     }
     $data = $_SESSION['steps'];
     $nid = param_num("nid");
     $cid = param_num("cid");
     #information message, step 2
     if ($data['deletecom']) {
         #save step
         unset($data['deletecom']);
         $_SESSION['steps'] = $data;
         $this->forms['information']['url'] = $this->backtracking->backlink();
         $this->forms['information']['action'] = "comments";
         $this->forms['information']['title'] = "Kommentar löschen";
         $this->forms['information']['message'] = "Kommentar erfolgreich gelöscht";
         $this->forms['information']['style'] = "green";
         $this->show('message_information', "Kommentar löschen");
     }
     if (!$cid) {
         $this->_header($this->backtracking->backlink());
     }
     $return = getNewsComment($cid);
     if (!$return) {
         $this->_header($this->backtracking->backlink());
     }
     $newsdata = getNews($nid);
     if (!$newsdata) {
         $this->_header($this->backtracking->backlink());
     }
     #deletecom, send
     if ($_REQUEST['send']) {
         if ($_REQUEST['yes_x']) {
             addToLogfile("Kommentar bei <b>" . $newsdata['title'] . "</b> gelöscht", "News", $this->userdata['uid']);
             deleteNewsCom($return['cid']);
             #save step
             $data['deletecom'] = 1;
             $_SESSION['steps'] = $data;
             $this->_header("index.php?action=deletecom&nid=" . $nid . "&send");
         } else {
             $this->_header($this->backtracking->backlink());
         }
     } else {
         $this->forms['information']['url'] = "index.php?nid={$nid}&cid={$cid}";
         $this->forms['information']['action'] = "deletecom";
         $this->forms['information']['title'] = "Kommentar löschen";
         $this->forms['information']['message'] = "Kommentar löschen ? <br><br>" . formatTextData($return['content']);
         $this->forms['information']['style'] = "black";
         $this->show('message_question', "Kommentar löschen");
     }
 }
示例#4
0
文件: admin.php 项目: sangikumar/IP
}
?>
                
            </div>
		
		</div>
 
	</div>    <!-- content End -->

	<!-- Footer Include -->
    <div id="footer"><?php 
include_once 'footer.php';
?>
</div> <!-- wrraper End -->
<script type="text/javascript">
	
    $('.dispScrolled ul').cycle({
        fx: 'scrollUp'
    });
    
    $('#newsDisp div').cycle({
        fx: 'fade'
    });
</script>
<div id="newsDisp">
    <?php 
echo getNews();
?>
</div>
</body>
</html>
示例#5
0
</script>
	</div>
	
	</aside>
	<section id="main_section"><!-- meet of the website-->
		<article class="trendingThreads trending threads topics abc article">
			<header><p class="channelHeder">Popular on the ABC forum</p></header>
			<div class="div trendingThreads trending threads topics abc">
			<?php 
loadTrendingThreads();
?>
			</div>
		</article>
			<article><header><p class="newsHeader">News</p></header>
		<?php 
getNews();
?>
		</article>
	</section>
	<!-- twitter causes the center div not to move -->
	<aside id="trendingNow" class="sideRight side_news twitter feed trendingNow general"><!-- id was side_news-->
	     <div class="twitter"> 
	      <a class="twitter-timeline"  href="https://twitter.com/ABCNetwork" data-widget-id="570623846131052544">Tweets by @ABCNetwork</a>
          <script type="text/javascript">!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script> 
	</div>
	<div class="ad" style="width:15%;">
		
	
	</div>
	</aside>
	</div> <!-- end new div-->
function view()
{
	$b=h1("News").getNews();

	return menuSystem($b);
}
示例#7
0
    displayNews(getNews($news_id));
    displayComments(getNewsComments($news_id));
    return;
} else {
    if (defined('INDEX_MODULE')) {
        $news = getNews(null, $limit, $index);
        displayNews($news, true);
        OpenContent();
        ?>
		<div style="float:right;">
			<a href="?load=news">Read All</a>&nbsp;
		</div>

<?php 
    } else {
        $news = getNews(null, $limit, $index);
        OpenContent();
        if ($page_num > 0) {
            echo "&nbsp;<a href=\"?load=news&page={$page_num}\">More Recent News</a>";
        }
        if (count($news) == $limit) {
            ?>
			<div style="float:right;">
				<a href="?load=news&page=<?php 
            echo $page_num + 2;
            ?>
">Older News</a>&nbsp;
			</div>
			<div class="clear"></div>	
<?php 
        }
示例#8
0
<?php

$TITLE = "Main";
include "inc.head.php";
echo getSplotch("missionstatement");
echo getNews(0, 10);
include "inc.foot.php";
示例#9
0
                            
                            <div class="alert alert-info">
                                <h1 >Haberler</h1>
                                <p>Haberleri düzenlemek ya da silmek için listenin sağ tarafındaki butonları kullanınız.</p>
                            </div>
                            
                            <table class="table table-bordered table-hover">
                                <tr>
                                    <th>Durum</th>
                                    <th>Başlık</th>
                                    <th>İçerik</th>
                                    <th>Tarih</th>
                                    <th>Düzenle</th>
                                </tr>
                                <?php 
$allNews = getNews();
?>
                                <?php 
while ($news = mysql_fetch_array($allNews)) {
    ?>
                                <tr>
                                    <td>
                                        <?php 
    if ($news[1] == 0) {
        echo "Taslak";
    } else {
        echo "Yayında";
    }
    ?>
                                    </td>
示例#10
0
										<input type="submit" name="submit" value="CONNEXION">
									</div>
								</form>
							</div>
						</div>
				</div>
			</div>
		<?php 
} else {
    ?>
			<div class="col-xs-12 col-sm-6">
				<div class="box">
					<div class="title">Nouveautés:</div>
					<div class="news">
						<?php 
    foreach (getNews() as $news) {
        echo '<div class="title">' . Utils::shorten($news['title'], 35) . '</div>';
        echo '<div class="news">' . Utils::shorten($news['news'], 127) . '</div>';
        echo "<hr/>";
    }
    ?>
					</div>
				</div>
			</div>
			<div class="col-xs-12 col-sm-6">
				<div class="box">
					<div class="title">Travaux:</div>
					<div class="news">
						<?php 
    foreach (getWorks() as $work) {
        echo '<div class="title">' . Utils::shorten($work['title'], 35) . '</div>';
示例#11
0
//POST
$news = 'Четыре новосибирские компании вошли в сотню лучших работодателей
Выставка университетов США: открой новые горизонты
Оценку «неудовлетворительно» по качеству получает каждая 5-я квартира в новостройке
Студент-изобретатель раскрыл запутанное преступление
Хоккей: «Сибирь» выстояла против «Ак Барса» в пятом матче плей-офф
Здоровое питание: вегетарианская кулинария
День святого Патрика: угощения, пивной теннис и уличные гуляния с огнем
«Красный факел» пустит публику на ночные экскурсии за кулисы и по закоулкам столетнего здания
Звезды телешоу «Голос» Наргиз Закирова и Гела Гуралиа споют в «Маяковском»';
$news = explode("\n", $news);
if (isset($_POST['id'])) {
    $id = $_POST['id'];
    if (is_numeric($id) && array_key_exists($id, $news)) {
        getNews($id);
    } else {
        echo "Новости с таким id не существует";
    }
} else {
    header("HTTP/1.0 404 Not Found");
    echo "Страница не найдена, воспользуйтесь формой поиска, введите от 0 до 9<br/>";
    ?>
    
    <form method="POST">
        <input type="text" name="id" id="">
        <input type="submit" value="Показать">
    </form>
    
    <?php 
    news();
示例#12
0
//on souhaite 5 news par page, le nombre de page est égal au nombre de news total divisé par 5.
//dans la plupart des cas, on aura un réel. pas de possibilité d'avoir 2.6 pages, on rajoute une page au cas où ca ne tombe pas juste
$nbPages = (int) ($nbNews / $newsParPage) + 1;
//on vérifie qu'au cas où le résultat tombe juste, on affiche pas une page en plus qui serait vide
if ($nbNews % $newsParPage == 0) {
    $nbPages = $nbPages - 1;
}
if (!isset($_GET['page'])) {
    $_GET['page'] = '1';
}
// pas de pages --> page 1
//on transforme le numero de page en entier, si la variable page n'est pas un nombre, page sera égal à 0
if (isset($_GET['page'])) {
    $page = (int) $_GET['page'];
}
//on vérifie maintenant que le numero de page existe bien
if (isset($page) and $page <= $nbPages and $page > 0) {
    $newsArray = getNews(($page - 1) * $newsParPage, $newsParPage, 'dateOrder DESC');
    foreach ($newsArray as $n) {
        $nbCommentNews[$n['ID']] = nbComments($n['ID']);
    }
    include_once 'vue/news/index.php';
} else {
    $js = false;
    $redirect[0] = 'news.php?op=index';
    $redirect[1] = '1';
    $page = 'accueil';
    $titreErreur = 'news : erreur';
    $erreur = 'Aucune news ne se trouve sur cette page!';
    include_once 'vue/erreur.php';
}
示例#13
0
function getTopNews()
{
	echo getNews(true);
}
示例#14
0
		$str = substr($text,$pos + 5,$pos2 - $pos - 5);
		$str2 = "internal_".$str;
		$text = str_replace("[var:".$str."]", @$$str2, $text);
	}*/
//
// end
//
//
// load style
//
$page = str_replace("[title]", $title, $page);
$page = str_replace("[text]", $text, $page);
$page = str_replace("[menu]", generatemenu(@$internal_style, 1, $extern_page), $page);
$page = str_replace("[menu2]", generatemenu(@$internal_style, 2, $extern_page), $page);
include "news.php";
$page = str_replace("[news]", getNews(), $page);
$page = str_replace("[position]", position_to_root($page_data->page_id), $page);
if (strpos($page, "[gbook-")) {
    include "gbook.php";
    $page = str_replace("[gbook-input]", gbook_input(), $page);
    $page = str_replace("[gbook-pages]", gbook_pages(), $page);
    $page = str_replace("[gbook-content]", gbook_content(), $page);
}
if (strpos($page, "[contact]")) {
    include "contact.php";
    $page = str_replace("[contact]", contact_formular(), $page);
}
$inlinemenu = '';
if ($page_data->inlinemenu_html != null) {
    include './styles/' . $internal_style . '/menue.php';
    $inlinemenu = $menu_inline;
示例#15
0

<html>
	
	<div id="main">

		<div id="headerimg"><img src="img/head/5_h.png"></div>

		<h1>nyheter</h1>

		<div id="nyhet">

		<?php 
if (isset($_GET['news'])) {
    $news_id = $_GET['news'];
    $nyhet = getNews($news_id);
    if ($nyhet['news_pic']) {
        print '<div class="news_img"><img src="img/news/' . $nyhet['news_pic'] . '"></div>';
    }
    print mb_strtolower('<h1>' . $nyhet['news_title'] . '</h1>', 'UTF-8');
    print '<p>' . $nyhet['news'] . '</p>';
    print '<div class="datum">' . convertDate($nyhet['news_date']) . '</div>';
    print '<div class="border"></div>';
}
print '</div>';
print '<div id="container">';
foreach ($news as $news) {
    print '<div class="item">';
    print '<div class="wrap pil hvr-grow">';
    if ($news['news_pic']) {
        print '<a href="news.php?news=' . $news['news_id'] . '"><img src="img/news/' . $news['news_pic'] . '"></a>';
示例#16
0
$category = get_the_category();
$cat_id = $category[0]->cat_ID;
$linkSrc = esc_url(get_home_url());
if ($cat_id == getBusiArticles()) {
    $titleClass = "businesstitle";
    $linkName = "Business Insurance Articles";
    $linkSrc = $linkSrc . "/business-insurance/articles/";
} elseif ($cat_id == getAutoArticles()) {
    $titleClass = "autotitle";
    $linkName = "Auto Insurance Articles";
    $linkSrc = $linkSrc . "/auto-insurance/articles/";
} elseif ($cat_id == getHomeArticles()) {
    $titleClass = "homeownerstitle";
    $linkName = "Homeowners Insurance Articles";
    $linkSrc = $linkSrc . "/homeowners-insurance/articles/";
} elseif ($cat_id == getNews()) {
    $titleClass = "generictitle";
    $linkName = "News";
    $linkSrc = $linkSrc . "/about/news/";
}
?>
		
	<h1 class="<?php 
echo $titleClass;
?>
"><?php 
the_title();
?>
</h1>
		<hr class="line" />
		<?php 
示例#17
0
include_once 'modele/news/getNombreNews.php';
$newsParPage = 20;
//pour la pagination, on va compter le nombre de produits correspondant à notre requète
$nbNews = getNombreNews();
//on souhaite 5 news par page, le nombre de page est égal au nombre de news total divisé par 5.
//dans la plupart des cas, on aura un réel. pas de possibilité d'avoir 2.6 pages, on rajoute une page au cas où ca ne tombe pas juste
$nbPages = (int) ($nbNews / $newsParPage) + 1;
//on vérifie qu'au cas où le résultat tombe juste, on affiche pas une page en plus qui serait vide
if ($nbNews % $newsParPage == 0) {
    $nbPages = $nbPages - 1;
}
if (!isset($_GET['page'])) {
    $_GET['page'] = '1';
}
// pas de pages --> page 1
//on transforme le numero de page en entier, si la variable page n'est pas un nombre, page sera égal à 0
if (isset($_GET['page'])) {
    $page = (int) $_GET['page'];
}
//on vérifie maintenant que le numero de page existe bien
if (isset($page) and $page <= $nbPages and $page > 0) {
    $newsArray = getNews(($page - 1) * $newsParPage, $newsParPage, 'ID DESC');
    include_once 'vue/news/admin/index.php';
} else {
    $js = false;
    $admin = false;
    $page = 'admin';
    $titreErreur = 'administration ~ news - erreur';
    $erreur = 'Aucune news ne se trouve sur cette page!';
    include_once 'vue/erreur.php';
}
示例#18
0
<?php

require_once $_SERVER['DOCUMENT_ROOT'] . 'cloud/models/main/index.php';
ini_set('display_errors', 1);
error_reporting(E_ALL);
session_start();
$_SESSION['count'] = 1;
$resp = getNews();
echo json_encode($resp);
function getNews()
{
    $dat = json_decode('[{"targetUrl":"http://www.example.com","requestType":"text","outputAsJson":true,"loadImages":true,"isDebug":true, "timeout":15000, "postDomLoadedTimeout":5000, "userAgent":"PhantomJs.Cloud Rocks", "requestId":"myCustomData01"}]', true);
    $postdata = http_build_query($dat);
    $opts = array('http' => array('method' => 'POST', 'header' => 'Content-type: application/x-www-form-urlencoded', 'content' => $postdata));
    $context = stream_context_create($opts);
    $result = file_get_contents('http://api.phantomjscloud.com/batch/browser/v1/6feb6f3726e83a37bcd615db12ccf57eb9b3162e/dfdffdfddgfdf/', false, $context);
    echo $result;
    /*
    		$startDate = "2012-01-01";
     				$hmm = date('d/m/Y', strtotime($startDate));
      				echo($hmm);
    */
    $something = file_get_contents("https://www.google.com/search?q=bitcoin&hl=en&gl=us&authuser=0&source=lnt&tbs=cdr:1,cd_min:09/2/2014,cd_max:09/2/2014&tbm=nws");
    $ch = curl_init('https://www.google.com/search?q=bitcoin&hl=en&gl=us&authuser=0&source=lnt&tbs=cdr:1,cd_min:09/2/2014,cd_max:09/2/2014&tbm=nws');
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    $result = curl_exec($ch);
    echo $result;
    //$splits= explode('<a href="/url?q=', $something);
    //print_r($splits);
    //echo($something);
    return true;
示例#19
0
文件: news.php 项目: symbolicdata/web
<?php

/**
 * User: Hans-Gert Gräbe
 * Date: 2016-02-21
 */
require_once "layout.php";
require_once "php/News.php";
$content = '      
<div class="container">
<h1 align="center">News</h1>

<p>The following list of news is extracted from different sources.  Most of the
news are retweeted to the <a
href="http://lists.informatik.uni-leipzig.de/mailman/listinfo/sd-announce"
>sd-announce mailing list</a> to have reliable archive links for reference.
</p>


' . getNews() . '
</div>
';
echo showPage($content);
示例#20
0
$lang = $vars['lang'];
$template .= '<h1>Archives</h1><br />';
if (isset($vars['y']) && !empty($vars['y'])) {
    if (isset($vars['m']) && !empty($vars['m'])) {
        $month = str_pad($vars['m'], 2, "0", STR_PAD_LEFT);
        $results = getNews('article_date::' . $vars['y'] . '-' . $month . '%');
        if (count($results) == 0) {
            $lMonth = getFullMonthName($month, $lang);
            $template .= "<p>Pas d'article trouvé en base pour le mois " . $lMonth . ".</p>";
        } else {
            foreach ($results as $news) {
                $template .= '<div class="article"><div class="article-header">' . ' <h1>' . $news["title"] . '</h1>' . '</div>' . $news["description"] . '<a href="' . root() . '/' . $news["link"] . '">Lire la suite</a>' . '<div class="social-media-end">' . '</div>' . '</div>';
            }
        }
    } else {
        $template .= '<div id="archives">';
        for ($i = 12; $i >= 1; $i--) {
            $month = str_pad($i, 2, "0", STR_PAD_LEFT);
            $results = getNews('article_date::' . $vars['y'] . '-' . $month . '%');
            $template .= '<div class="article">' . '    <p><a href="' . root() . '/archives/' . $vars['y'] . '/' . $month . '">' . ucfirst(getFullMonth($month, $lang)) . '</a> (' . count($results) . ')</p>' . '</div>';
        }
        $template .= '</div>';
    }
} else {
    $template .= '<div id="archives">';
    for ($i = $current_year; $i >= $open_year; $i--) {
        $results = getNews('article_date::' . $i . '%');
        $template .= '<div class="article">' . '    <p><a href="' . root() . '/archives/' . $i . '">' . $i . '</a> (' . count($results) . ')</p>' . '</div>';
    }
    $template .= '</div>';
}
示例#21
0
    $newsSource24 = 'RT';
    $tweetArray24 = array();
    array_push($tweetArray, getNews($getfield24, $newsSource24, $settings, $api_key, $tweetArray24, $tags_array));
    ///////
    $getfield25 = '?screen_name=Turkey';
    $newsSource25 = 'Turkey';
    $tweetArray25 = array();
    array_push($tweetArray, getNews($getfield25, $newsSource25, $settings, $api_key, $tweetArray25, $tags_array));
    $getfield26 = '?screen_name=SkyNewsAust';
    $newsSource26 = 'SkyNewsAust';
    $tweetArray26 = array();
    array_push($tweetArray, getNews($getfield26, $newsSource26, $settings, $api_key, $tweetArray26, $tags_array));
    $getfield27 = '?screen_name=globalnews';
    $newsSource27 = 'Global News';
    $tweetArray27 = array();
    array_push($tweetArray, getNews($getfield27, $newsSource27, $settings, $api_key, $tweetArray27, $tags_array));
    //var_dump($tweetArray);
}
$newsSourceArray = array();
$latitudeArray = array();
$longitudeArray = array();
$sTweetArray = array();
$urlArray = array();
for ($x = 0; $x < 24; $x++) {
    for ($i = 0; $i < sizeof($tweetArray[$x]); $i++) {
        array_push($newsSourceArray, $tweetArray[$x][$i]->newsSource);
        array_push($sTweetArray, $tweetArray[$x][$i]->stweet);
        array_push($latitudeArray, $tweetArray[$x][$i]->latitude);
        array_push($longitudeArray, $tweetArray[$x][$i]->longitude);
        array_push($urlArray, $tweetArray[$x][$i]->url);
    }
示例#22
0
<?php

define('ANNOUNCEMENTS_FORUM_NAME', "Announcements");
define('WEBSITE_BASE_URL', "http://forums.openkore.com/");
define('FORUM_DATABASE_ENCODING', 'UTF-8');
define('IN_PHPBB', true);
$phpbb_root_path = './';
include $phpbb_root_path . 'extension.inc';
include $phpbb_root_path . 'common.' . $phpEx;
header("Content-Type: application/xml");
printNewsFeed(getNews());
function getNews($limit = 8)
{
    global $db;
    $sql = sprintf("SELECT topic_id, topic_title, topic_time " . "FROM %s WHERE forum_id = " . "(SELECT forum_id FROM %s WHERE forum_name = '%s' LIMIT 1) " . "ORDER BY topic_time DESC " . "LIMIT %d", TOPICS_TABLE, FORUMS_TABLE, addslashes(ANNOUNCEMENTS_FORUM_NAME), $limit);
    $result = $db->sql_query($sql);
    if (!result) {
        die("Cannot query database.");
    }
    $rows = $db->sql_fetchrowset($result);
    $db->sql_freeresult($result);
    for ($i = 0; $i < count($rows); $i++) {
        $rows[$i]['topic_title'] = html_entity_decode($rows[$i]['topic_title'], ENT_QUOTES, FORUM_DATABASE_ENCODING);
    }
    return $rows;
}
function printNewsFeed($news)
{
    global $phpEx;
    echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
    echo "<announcements>\n";
示例#23
0
<?php

$template = "";
$id = $_GET['id'];
$news = getNews("id::" . $id);
$myDB = new DBFactory();
$sql = $myDB->getMysqlConnexionWithPDO();
if (count($news) == 0) {
    echo "L'article avec l'ID " . $id . " n'a pas été trouvé en base.";
} else {
    if (count($news) > 1) {
        echo "Query returned more than 1 statement. You're in serious trouble buddy :'(<br />Contact your sysadmin ASAP !";
    } else {
        ?>
<form class="article" action="<?php 
        echo root();
        ?>
/include/query.php" method="post">
	<div class="90p middle-align">
		<input type="hidden" name="action" value="edit_article" />
		<input type="hidden" name="id" value="<?php 
        echo $id;
        ?>
" />
		<input type="hidden" name="checksum" value="<?php 
        echo $news[0]['checksum'];
        ?>
" />
		<div class="article-header"><h1>Editer un article</h1></div>
		<p>Titre : </p>
		<p><input type="text" name="title" value="<?php 
示例#24
0
<?php

function getNews($query, $start)
{
    $website = "https://ajax.googleapis.com/ajax/services/search/news?&num=20&v=1.0&q=" . $query . "&start=" . $start;
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $website);
    curl_setopt($ch, CURLOPT_HTTPGET, TRUE);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
    $output = curl_exec($ch);
    curl_close($ch);
    return $output;
}
$query = @$_POST["query"];
$start = @$_POST["start"];
echo getNews($query, $start);
<?php

# error case: no news file exists
if (!file_exists("news/news.xml") && !file_exists("news/skeleton.xml")) {
    echo "<b>ERROR: News file DNE!</b>";
} else {
    # Get the news
    if (!function_exists('getNews')) {
        include 'news/functions.php';
    }
    $news = getNews(1);
    # Print the news
    echo "<h3>News - " . $news[0]->date . "</h3>";
    echo "<p>" . $news[0]->content . "</p>";
    echo '<p><a href="news.php">See past news</a></p>';
}

    <section id="news-feed" class="blog text-center section-padding section-light">
        <div class="container-fluid container-news" id="news-trigger">
            <div class="row section-header">
                <div class="col-md-12">
                    <div class="sign"><i data-wow-duration="0.6s" data-wow-delay="0.2s" class="wow bounceInUp svg-box svg-ico icon-title"><?php 
includeSVG("line/news.svg");
?>
</i></div>
                    <h3>Новости и события компании</h3>
                </div>
            </div>
            <div class="row">
                <?php 
getNews(666);
?>
            </div>

            <div class="row func-buttons-group" style="display:none">
                <div class="col-md-4">
                <button class="btn btn-ghost btn-accent btn-small btn-more disabled"><span class="icon-clock"></span> Архив</button>
                </div>
                <div class="col-md-4 text-center">
                <button id="btn-more-news" class="btn btn-ghost btn-accent btn-small btn-more disabled"><span class="ln-icon-plus"></span> Загрузить ещё</button>
                </div>
                <div class="col-md-4">
                <button class="btn btn-ghost btn-accent btn-small btn-more disabled"><span class="icon-newspaper"></span> Журнал</button>
                </div>
            </div>
       </div>
示例#27
0
require_once 'conf.php';
require_once 'HTML/Template/IT.php';
// Setup template objects
if (!$usr->isLoggedIn()) {
    $tpl =& new HTML_Template_IT('./');
    $tpl->loadTemplatefile('login_form.tpl', true, false);
    $login = $tpl->get();
} else {
    $login = '******' . $usr->getProperty('handle') . ' !</p>';
    $login .= '<p><a href="admin.php">Go to the admin part</a></p>';
}
$tpl =& new HTML_Template_IT('./');
$tpl->loadTemplatefile('home.tpl', true, true);
// assign the content to the vars
$tpl->setVariable('GENERALNEWS', getNews($db, 'general'));
$tpl->setVariable('LOGIN', $login);
$tpl->show();
// This function is to fetch news from the DB
function getNews(&$db, $newsCategory)
{
    $query = "\n        SELECT\n            news_id      AS id,\n            DATE_FORMAT(news_date, '%D %b %Y at %H:%I:%S') AS date,\n            news_title   AS title,\n            news_content AS content\n        FROM\n            news\n        WHERE\n            news_category = '{$newsCategory}'\n        AND\n            news_id<>0\n        ORDER BY\n            date ASC";
    //    echo $query;
    $news = $db->getAssoc($query);
    if (DB::isError($news)) {
        die($news->getMessage() . ' ' . $news->getUserinfo());
    } else {
        $tpl =& new HTML_Template_IT('./');
        $tpl->loadTemplatefile('news.tpl', true, true);
        foreach ($news as $name) {
            echo "<div class=\"content\">";
示例#28
0
function joinGame($playerId, $alias, $tokens)
{
    // check to see that the player's state is NOTHING
    $sql = "SELECT state FROM players WHERE playerId='{$playerId}' LIMIT 1;";
    $result = mysql_query($sql) or sql_error_report($sql, $_SERVER["SCRIPT_NAME"]);
    if ($row = mysql_fetch_assoc($result)) {
        $state = $row['state'];
        if ($state != 'NOTHING') {
            $ret = array("status" => "BAD_STATE", "state" => $state);
            print json_encode($ret);
            return;
        }
    } else {
        $ret = array("status" => "IMPOSSIBLE7");
        die(json_encode($ret));
    }
    // check that the game with the correct token exists
    $tokenList = "'" . implode("','", explode(";\n", $tokens)) . "'";
    $sql = "SELECT gameId FROM games WHERE state = 'PENDING' AND token IN ({$tokenList}) LIMIT 1;";
    $result = mysql_query($sql) or sql_error_report($sql, $_SERVER["SCRIPT_NAME"]);
    if ($row = mysql_fetch_assoc($result)) {
        $gameId = $row['gameId'];
        // check to see if alias exists
        $sql = "SELECT * FROM participations WHERE alias='{$alias}' AND gameId = '{$gameId}' LIMIT 1;";
        $result = mysql_query($sql) or sql_error_report($sql, $_SERVER["SCRIPT_NAME"]);
        if (mysql_num_rows($result) == 1) {
            $ret = array("status" => "ALIAS_TAKEN");
            print json_encode($ret);
            return;
        }
        // get the code word
        $codewords = codewords();
        shuffle($codewords);
        do {
            $codeword = array_pop($codewords);
            $sql = "SELECT * FROM participations WHERE codeword = '{$codeword}' AND gameId = '{$gameId}' LIMIT 1;";
            $result = mysql_query($sql) or sql_error_report($sql, $_SERVER["SCRIPT_NAME"]);
        } while (mysql_num_rows($result) > 0);
        $sql = "INSERT INTO participations (gameId, playerId, state, alias, codeword) VALUES ('{$gameId}', '{$playerId}', 'ACTIVE', '{$alias}', '{$codeword}');";
        mysql_query($sql) or sql_error_report($sql, $_SERVER["SCRIPT_NAME"]);
        $sql = "UPDATE players SET state='PLAYING', waitingAlias='', waitingStart='0000-00-00 00:00:00', tokens='{$tokens}' WHERE playerId = '{$playerId}' LIMIT 1;";
        mysql_query($sql) or sql_error_report($sql, $_SERVER["SCRIPT_NAME"]);
        if (mysql_affected_rows() == 1) {
            $player = getPlayerObject($playerId);
            $news = getNews($playerId);
            $game = getGameObject($playerId, $gameId);
            $ret = array("status" => "OK", "player" => $player, "news" => $news, "game" => $game);
            print json_encode($ret);
            return;
        } else {
            $ret = array("status" => "IMPOSSIBLE8a");
            print json_encode($ret);
            return;
        }
    } else {
        // check to see if alias exists
        $sql = "SELECT * FROM players WHERE waitingAlias='{$alias}' LIMIT 1;";
        $result = mysql_query($sql) or sql_error_report($sql, $_SERVER["SCRIPT_NAME"]);
        if (mysql_num_rows($result) == 1) {
            $ret = array("status" => "ALIAS_TAKEN");
            print json_encode($ret);
            return;
        }
        $date = getDateNow();
        $sql = "UPDATE players SET waitingAlias='{$alias}', state='WAITING', waitingStart='{$date}', tokens='{$tokens}' WHERE playerId='{$playerId}' LIMIT 1;";
        mysql_query($sql) or sql_error_report($sql, $_SERVER["SCRIPT_NAME"]);
        if (mysql_affected_rows() == 1) {
            $player = getPlayerObject($playerId);
            $ret = array("status" => "OK", "player" => $player);
            print json_encode($ret);
            return;
        } else {
            $ret = array("status" => "IMPOSSIBLE8b");
            print json_encode($ret);
            return;
        }
    }
}
    echo "\n\t\t</div>\n\t\t</div>\n\t\t<div class='box' style='width:780px; margin:20px auto;'>\n\t\t<div class='table'>\n\t\t<form role ='form' id='delete_event' method='POST' action=''>\n\t\t\t<select name='eventname'>\n\t\t\t\t<option value='0'>Select event to be deleted: </option>";
    $events = getAllEvents();
    for ($i = 0; $i < count($events); $i++) {
        $evname = $events[$i]['event_name'];
        $id = $events[$i]['id'];
        echo "<option value='{$id}' ";
        if ($evntid == $id) {
            echo "selected";
        }
        echo ">" . ucFirst($evname) . "</option>";
    }
    echo "\n\t\t\t\t</select>\n\t\t\t<input type='submit' name='deleteevent' value='Delete Event'/><br>\n\t\t</form>\n\t\t</div>\n\t\t</div>\n\t\t<div class='box' style='width:780px; margin:20px auto;'>\n\t\t<div class='box-head'>\n\t\t\t<h2>Add News Feed</h2>\n\t\t</div>\n\t\t<div class='table'>\n\t\t\t<h4 style='margin-left:20px;margin-top:5px;\t padding:3px; color: rgb(216,71,71); line-height:20px;'>{$newsmsg} </h4>\t\n\t\t\t<form role='form' id='addnews' method='POST' action=''>\n\t\t\t\t<label>Heading: </label><input type='text' name='heading'/>\n\t\t\t\t<label>Content: </label><textarea name='content' cols='100' rows='5'></textarea>\n\t\t\t\t<label>Link: </label><input type='text' name='link'/>\n\t\t\t\t<label>Event: </label>\n\t\t\t\t<select name='event_id_news'>\n\t\t\t\t\t<option value='0'>Select event: </option>";
    $events = getAllEvents();
    for ($i = 0; $i < count($events); $i++) {
        $evname = $events[$i]['event_name'];
        $id = $events[$i]['id'];
        echo "<option value='{$id}'>" . ucFirst($evname) . "</option>";
    }
    echo "\n\t\t\t\t</select>\n\t\t\t\t<input type='submit' name='addnews' value='Add News'/><br>\t\n\t\t\t</form>\n\t\t\t\n\t\t\t\t\n\t\t</div>\n\t\t</div>\n\t\t<div class='box' style='width:780px; margin:20px auto;'>\n\t\t<div class='box-head'>\n\t\t\t<h2>Delete News Feed</h2>\n\t\t</div>\n\t\t<div class='table'>\n\t\t\t<h4 style='margin-left:20px;margin-top:5px;\t padding:3px; color: rgb(216,71,71); line-height:20px;'>{$newsdelmsg} </h4>\t\n\t\t\t<form role='form' id='deletenews' method='POST' action=''>\n\t\t\t\t<select name='news_heading'>\n\t\t\t\t\t<option value='0'>Select news heading to be deleted: </option>";
    $news = getNews();
    for ($i = 0; $i < count($news); $i++) {
        $heading = $news[$i]['heading'];
        $id = $news[$i]['id'];
        echo "<option value='{$id}'>" . ucFirst($heading) . "</option>";
    }
    echo "\n\t\t\t\t</select>\n\t\t\t\t<input type='submit' name='deletenews' value='Delete News'/><br>\t\n\t\t\t</form>\n\t\t\t\n\t\t\t\t\n\t\t</div>\n\t\t</div>\n\t\t";
}
?>

	
示例#30
0
文件: home.php 项目: dexz/dev-extaze
<?php

if (isset($_GET['a']) && !empty($_GET['a'])) {
    $news = getNews('short_access::' . $_GET['a']);
    if (count($news) == 0) {
        echo "L'article " . $_GET['a'] . " n'a pas été trouvé en base.";
    } else {
        if (count($news) > 1) {
            echo "Query returned more than 1 statement. You're in serious trouble buddy :'(<br />Contact your sysadmin ASAP !";
        } else {
            $news = $news[0];
            $template = '<div class="article">' . ' <div class="article-header">' . '     <h1>' . $news["title"] . '</h1>' . ' </div>' . $news["content"] . ' <div class="social-media">' . '     <div class="fb-like" data-href="' . root() . '/' . $news["link"] . '" data-layout="button" data-action="like" data-show-faces="false" data-share="true">' . '     </div>' . ' </div>' . ' <div class="social-media-end">' . ' </div>' . '</div>';
        }
    }
} else {
    $template = getAllVisibleNews();
}