function show_page($page) { $template = "view/templates/default_template.php"; if (file_exists($template) && is_file($template)) { require_once $template; } else { require_once "view/templates/default_template.php"; } echo get_document_head(); echo get_header_start(); if (is_logged_in()) { echo get_logout(); } else { } echo get_header_end(); if (is_logged_in()) { echo get_menu(); } else { echo get_guest_menu(); } if (is_logged_in()) { if ($page == "startpage") { echo "startpage"; } else { if ($page == "fileupload") { echo get_fileupload(); } else { if ($page == "nyheter") { echo get_news(); } else { if ($page == "flowing") { echo get_flowing(); } else { if ($page == "event") { echo get_event(); } else { if ($page == "profile") { $user_id = 1; echo get_profile($user_id); } else { echo get_default(""); } } } } } } } else { echo get_login(); } echo get_footer(); echo get_document_end(); }
function news_mangament_print() { echo ' <table class="content"> <tr> <td>ID</td> <td>Wiadomość</td> <td>Data wiadomośći</td> <td>Modyfikuj</td> <td>Usuń</td> </tr> '; $news = get_news(); foreach ($news as $msg) { echo '<tr> <td> <form action="index.php" method="POST"> ' . $msg['id_message_board'] . ' </td> <td> <input type="text" name="message_message_board" value="' . $msg['message_message_board'] . '"/> </td> <td> ' . $msg['date_message_board'] . ' </td> <td> <input type="hidden" name="update_news_id" value="' . $msg['id_message_board'] . '"/> <input type="hidden" name="kat" value="settings"/> <input type="hidden" name="id" value="updatenews"/> <input type="submit" name="update_news_submit" value="Aktualizuj"/> </form> </td> <td> <form action="index.php" method="POST"> <input type="hidden" name="delete_news" value="' . $msg['id_message_board'] . '"/> <input type="hidden" name="kat" value="settings"/> <input type="hidden" name="id" value="deletenews"/> <input type="submit" name="delete_news_submit" value="Usuń"/> </form> </td> </tr>'; } echo ' </table> '; }
function show_page($page) { $template = ''; $posts_per_page = 5; $page_nr = isset($_GET['page_nr']) ? $_GET['page_nr'] : '0'; $limit = $page_nr * $posts_per_page . ", {$posts_per_page}"; // $template_file = select_from_db(array('blogs.template'), array('blogs'), array("blogs.name='$page'")); // $template = "view/templates/" . $template_file[0]['template']; $template = "view/templates/default_template.php"; if (file_exists($template) && is_file($template)) { require_once $template; } else { require_once "view/templates/default_template.php"; } echo get_document_head(); echo get_header(); echo get_menu(); if ($page == "startpage") { echo "startpage"; } else { if ($page == "search") { echo get_searchbar(); echo get_search_results(); echo get_thechosen(); } else { if ($page == "fileupload") { echo get_fileupload(); } else { if ($page == "nyheter") { echo get_news(); } else { if ($page == "receipes") { $recipe = "Hallonmums"; echo get_recipes($recipe); } else { echo get_default("Välkommen"); } } } } } echo get_footer(); echo get_document_end(); }
/** * prints out the news (for the HTML pages) */ function print_news_html($type, $number) { $news = get_news($type, $number); // see if we have no news items... if ($news == "No news.") { print "No news items."; } else { // split the news posts into separate ones $news_posts = explode("_____", $news); // split a news post into its individual parts foreach ($news_posts as $news_post) { // to strip out the blank one if ($news_post != "") { list($id, $timestamp, $subject, $body) = explode("::::", $news_post); print "<div class=\"news_item\"><p class=\"news_subject\">{$subject}</p><p class=\"news_body\">{$body}</p><p class=\"news_byline\"><a href=\"news.php?archive&id={$id}\" title=\"{$subject}\">Posted at " . date("m-d-y h:i:s", $timestamp) . "</a></p></div>"; } } } }
function public_menu() { //funkcija koja sluzi za generisanje menija koji ce se prikazivati javnim korisnicima $result = get_all('categories'); $output = '<ul class="nav navbar-nav">'; while ($category = mysqli_fetch_assoc($result)) { $all_news = get_news($category['id']); if (mysqli_num_rows($all_news) > 0 && $category['visible'] == 1) { //ako je kategorija vidljiva i ima vidljivih vijesti $output .= '<li class="dropdown">'; $output .= '<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">' . $category['title'] . '<span class="caret"></span></a>'; $output .= '<ul class="dropdown-menu">'; while ($news = mysqli_fetch_assoc($all_news)) { $output .= '<li><a href="index.php?id=' . $news['id'] . '">' . $news['title'] . '</a></li>'; } $output .= '</ul>'; $output .= '</li>'; } } $output .= '</ul>'; return $output; }
function get_content() { global $content; $file = 'pages/' . in('p'); if (in('dyn')) { $id = in('dyn'); $content = get_dyn_content($id); return; } if (in('l') == 'eng') { $file .= '_e'; } $file .= '.html'; if (in('p') == 'news') { $content = get_news(in('id')); return; } if (!in('p')) { $id = in('l') == 'eng' ? 26 : 9; $content = get_dyn_content($id); $t = new Template("inc/news.tmpls"); $c = get_news_list(1, 0); // avalehele kolm uudist koos kstga if (in('l') == 'eng') { $tmpl = 'news1_e'; } else { $tmpl = 'news1'; } $news_content = $t->get($tmpl, array($c)); $content = preg_replace("/\\[UUDISED\\]/", $news_content, $content); return; } if (file_exists($file)) { $content = implode("\n", file($file)); list($savi, $content, $savi) = explode("<delimiter>", $content); } else { if (in('l') == 'eng') { $content = 'Coming soon...'; } else { $content = 'Valmimas...'; } } }
/** * 依据给定的地址和规则采集并发表文章 * @package WordPress * @subpackage Auto-Post-News * @since 0.0.1 * @param array $news_args 所有需要用到的参数,参考示例 * @return bool 成功则返回文章ID,失败则返回具体原因 */ function post_news() { $news_args = array('lock_file' => dirname(__FILE__) . '/post.lock', 'news_list_type' => 'rss', 'news_rss' => 'http://feeds.bbci.co.uk/news/business/rss.xml', 'news_max' => 2, 'auto_matche' => FALSE, 'news_pattern' => array(array('<!-- / story-body -->', '|<h1 class="story-header">([\\W\\w]*?)</h1>([\\W\\w]*?)</div><!-- / story-body -->|i'), array('<div id="page-bookmark-links-foot"', '|<h1 class="story-header">([\\W\\w]*?)</h1>([\\W\\w]*?)<div id="page-bookmark-links-foot"|i'), array('<table class="storycontent"', '|<table class="storycontent"[\\W\\w]*?<h1>([\\W\\w]*?)</h1>([\\W\\w]*?)<!-- body - End -->|i')), 'preg_replace' => array('|<noscript>[\\W\\w]*?</noscript>|i', '|<script[\\W\\w]*?</script>|i', '|<form[\\W\\w]*?</form>|i', '|<ul class="related-links-list">[\\W\\w]*?</ul>|i', '|<!--[\\W\\w]*?-->|i', '|<[a-z][^>]*></[^>]*>|i', '|<div class="read-more">[\\W\\w]*?</div>|i'), 'str_replace' => array("\n", "\t", "\r", "", "\v", ' ', 'Continue reading the main story'), 'has_content_post' => 'publish', 'no_content_post' => 'draft', 'author' => '1', 'category_name' => 'Business', 'rss_time' => FALSE, 'add_more' => array(TRUE, 1000, 500), 'publish_time' => TRUE, 'orgin_link' => TRUE); if (lock('check', $news_args['lock_file']) == 'locked') { return 'Locked'; } ignore_user_abort(TRUE); $rss = fetch_feed($news_args['news_rss']); if (!is_wp_error($rss)) { $items = $rss->get_items(); } else { lock('delete', $news_args['lock_file']); return $rss; } $post_guids = get_guids('numberposts=50&post_status=publish,draft'); $allowedposttags = array('address' => array(), 'a' => array('href' => array(), 'id' => array(), 'title' => array(), 'rel' => array(), 'rev' => array(), 'name' => array(), 'target' => array()), 'abbr' => array('title' => array()), 'acronym' => array('title' => array()), 'article' => array('align' => array(), 'dir' => array(), 'lang' => array(), 'xml:lang' => array()), 'aside' => array('align' => array(), 'dir' => array(), 'lang' => array(), 'xml:lang' => array()), 'b' => array(), 'big' => array(), 'blockquote' => array('id' => array(), 'cite' => array(), 'lang' => array(), 'xml:lang' => array()), 'br' => array('class' => array()), 'caption' => array('align' => array(), 'class' => array()), 'cite' => array('dir' => array(), 'lang' => array(), 'title' => array()), 'code' => array(), 'col' => array('align' => array(), 'char' => array(), 'charoff' => array(), 'span' => array(), 'dir' => array(), 'valign' => array(), 'width' => array()), 'del' => array('datetime' => array()), 'dd' => array(), 'details' => array('align' => array(), 'dir' => array(), 'lang' => array(), 'open' => array(), 'xml:lang' => array()), 'dl' => array(), 'dt' => array(), 'em' => array(), 'figure' => array('align' => array(), 'dir' => array(), 'lang' => array(), 'xml:lang' => array()), 'figcaption' => array('align' => array(), 'dir' => array(), 'lang' => array(), 'xml:lang' => array()), 'font' => array('color' => array(), 'face' => array(), 'size' => array()), 'footer' => array('align' => array(), 'dir' => array(), 'lang' => array(), 'xml:lang' => array()), 'h1' => array('align' => array(), 'id' => array()), 'h2' => array('align' => array(), 'id' => array()), 'h3' => array('align' => array(), 'id' => array()), 'h4' => array('align' => array(), 'id' => array()), 'h5' => array('align' => array(), 'id' => array()), 'h6' => array('align' => array(), 'id' => array()), 'header' => array('align' => array(), 'dir' => array(), 'lang' => array(), 'xml:lang' => array()), 'hgroup' => array('align' => array(), 'dir' => array(), 'lang' => array(), 'xml:lang' => array()), 'hr' => array('align' => array(), 'noshade' => array(), 'size' => array(), 'width' => array()), 'i' => array(), 'img' => array('alt' => array(), 'align' => array(), 'border' => array(), 'height' => array(), 'hspace' => array(), 'longdesc' => array(), 'vspace' => array(), 'src' => array(), 'width' => array()), 'ins' => array('datetime' => array(), 'cite' => array()), 'kbd' => array(), 'li' => array('align' => array(), 'class' => array()), 'menu' => array('type' => array()), 'p' => array('align' => array(), 'dir' => array(), 'lang' => array(), 'xml:lang' => array()), 'pre' => array('width' => array()), 'q' => array('cite' => array()), 's' => array(), 'span' => array('dir' => array(), 'align' => array(), 'lang' => array(), 'title' => array(), 'xml:lang' => array()), 'section' => array('align' => array(), 'dir' => array(), 'lang' => array(), 'xml:lang' => array()), 'strike' => array(), 'strong' => array(), 'sub' => array(), 'summary' => array('align' => array(), 'dir' => array(), 'lang' => array(), 'xml:lang' => array()), 'sup' => array(), 'table' => array('align' => array(), 'bgcolor' => array(), 'border' => array(), 'cellpadding' => array(), 'cellspacing' => array(), 'dir' => array(), 'id' => array(), 'rules' => array(), 'summary' => array(), 'width' => array()), 'tbody' => array('align' => array(), 'char' => array(), 'charoff' => array(), 'valign' => array()), 'td' => array('abbr' => array(), 'align' => array(), 'axis' => array(), 'bgcolor' => array(), 'char' => array(), 'charoff' => array(), 'colspan' => array(), 'dir' => array(), 'headers' => array(), 'height' => array(), 'nowrap' => array(), 'rowspan' => array(), 'scope' => array(), 'valign' => array(), 'width' => array()), 'tfoot' => array('align' => array(), 'char' => array(), 'charoff' => array(), 'valign' => array()), 'th' => array('abbr' => array(), 'align' => array(), 'axis' => array(), 'bgcolor' => array(), 'char' => array(), 'charoff' => array(), 'colspan' => array(), 'headers' => array(), 'height' => array(), 'nowrap' => array(), 'rowspan' => array(), 'scope' => array(), 'valign' => array(), 'width' => array()), 'thead' => array('align' => array(), 'char' => array(), 'charoff' => array(), 'valign' => array()), 'title' => array(), 'tr' => array('align' => array(), 'bgcolor' => array(), 'char' => array(), 'charoff' => array(), 'valign' => array()), 'tt' => array(), 'u' => array(), 'ul' => array('type' => array()), 'ol' => array('start' => array(), 'type' => array()), 'video' => array('autoplay' => array(), 'controls' => array(), 'height' => array(), 'loop' => array()), 'preload' => array(), 'src' => array(), 'width' => array()); $count_post = 0; foreach ($items as $item) { $news_matche = array(); $post = array(); if (in_array($item->get_id(), $post_guids)) { continue; } $news = get_news($item->get_id()); //提取正文 if ($news == FALSE) { $post_content = $item->get_content(); $post_status = $news_args['no_content_post']; } else { foreach ($news_args['news_pattern'] as $pattern) { if (!$news_args['auto_matche'] && stripos($news, $pattern['0'])) { preg_match($pattern['1'], $news, $news_matche); break; } else { preg_match($pattern['1'], $news, $news_matche); } } // print_r($news_matche); if (!empty($news_matche)) { $post_content = $news_matche['2']; $post_status = $news_args['has_content_post']; } elseif ($item->get_content()) { $post_content = $item->get_content(); $post_status = $news_args['no_content_post']; } else { continue; } } $post_content = custom_replace($post_content, $news_args['str_replace'], $news_args['preg_replace']); $post_content = wp_kses($post_content, $allowedposttags); $post_content = wptexturize($post_content); $post_content = popuplinks($post_content); $post_content = make_link_absolute($post_content, $item->get_id()); if ($news_args['add_more']['0'] && strlen($post_content) > max(600, $news_args['add_more']['1'])) { $post_content = substr_replace($post_content, '<!--more-->', stripos($post_content, '</p>', max(300, $news_args['add_more']['2'])) + 4, 0); } if ($news_args['publish_time']) { $post_content .= '<br />Published at ' . $item->get_date(get_option('date_format') . ' ' . get_option('time_format')) . ' GMT'; } if ($news_args['orgin_link']) { $post_content .= '<br />From: <a target="_blank" title="' . $item->get_title() . '" href="' . $item->get_id() . '">' . $item->get_title() . '</a>'; } // echo $post_content . '<hr />'; $post_category = term_exists($news_args['category_name'], 'category'); if (!$post_category && $news_args['category_name']) { $post_category = wp_insert_term($news_args['category_name'], 'category'); } $post = array('post_status' => $post_status, 'post_author' => $news_args['author'], 'post_category' => $post_category ? array($post_category['term_id']) : '', 'post_date' => $news_args['rss_time'] ? $item->get_date() : '', 'post_content' => $post_content, 'post_excerpt' => $item->get_description(), 'post_title' => $item->get_title(), 'tags_input' => '', 'guid' => $item->get_id()); generic_ping(wp_insert_post($post)); if (++$count_post >= $news_args['news_max']) { break; } sleep('1'); } lock('delete', $news_args['lock_file']); }
<?php if (!file_exists('./includes/admin_config.php')) { header('Location:install.php'); } include 'front.php'; $smarty = new smarty(); smarty_front(); get_nav(); get_adds(); get_news(); get_hot_news(); get_new_message(); $smarty->display('index.html');
function emit_news($en_newspath, $lang_newspath, $oldnews) { global $top_dir; // a little debugging echo "<!-- in news/news-script.php: top_dir = {$top_dir} -->\n"; echo "<!-- lang-path: {$lang_newspath} ; en-path: {$en_newspath} -->\n"; # Be sure to define the following path to newsdirs if (!$en_newspath) { exit; } if (!$lang_newspath) { exit; } // This is how many news items to display on the main page. // Everything after this is displayed on the "oldnews" page. $cutoff = 10; $newsfiles = get_news($en_newspath, $lang_newspath); if ($oldnews) { $newsfile = array_slice($newsfiles, $cutoff, -1); } else { $newsfile = array_slice($newsfiles, 0, $cutoff); } // Output files to browser $filecount = 0; for (reset($newsfile); $key = key($newsfile); next($newsfile)) { $fa = file($key); $n = count($fa); $anchor = generate_anchor($key); print_news_item($fa, $n, $newsfile, $key, $anchor); } }
$len = strlen($semi_atom_date); return substr($semi_atom_date, 0, $len - 2) . ":" . substr($semi_atom_date, $len - 2); } echo "<?xml version=\"1.0\" encoding=\"{$charset}\"?>"; include "{$top_dir}/news/news-script.php"; ?> <feed xmlns="http://www.w3.org/2005/Atom"> <title>GnuCash News</title> <subtitle>GnuCash is personal and small-business financial-accounting software, freely licensed under the GNU GPL and available for GNU/Linux, BSD, Solaris, Mac OS X and Microsoft Windows.</subtitle> <generator>GnuCash htdocs/trunk/atom.php 1.0 <gnucash-devel@gnucash.org></generator> <logo>http://www.gnucash.org/images/icons/gnc-icon.png</logo> <link rel="alternate" href="http://www.gnucash.org/" /> <link rel="self" href="http://www.gnucash.org/atom.php" /> <?php $news_items = get_news($newsdir, $newsdir); $news_items = array_slice($news_items, 0, $entry_count); reset($news_items); $most_recent = file(key($news_items)); $most_recent_update = chop($most_recent[1]); ?> <updated><?php echo date_convert_news_to_atom($most_recent_update); ?> </updated> <?php for (reset($news_items); $key = key($news_items); next($news_items)) { $fa = file($key); $n = count($fa); $title = strip_tags(chop($fa[0]));
<div id="right-column"> <div id="latest-news"> <div class="news-header"> <h2>LATEST NEWS</h2><div class="title-right"><a href="<?php echo $_SERVER['DOCUMENT_ROOT']; ?> /channel_news">view more »</a></div> <div style="clear:both;"></div> </div> <div class="news-content"> <ul> <?php /* GETS NEWS FILTERED BY SECTION BEING VIEWED */ get_news($filter, $section); ?> </ul> </div> </div> </div> <?php } ?> </div> <?php } ?>
<?php include 'lib/PDO.php'; include 'lib/user.php'; if (!empty($_POST['action']) && $_POST['action'] == 'ajout') { include 'modele/index/ajout_news.php'; ajout_news($_POST); } else { //On affiche les 5 dernieres nouvelles sur l'accueil include_once 'modele/index/get_news.php'; $liste_news = get_news(0, 5); //securisation données foreach ($liste_news as $cle => $news) { $liste_news[$cle]['titre'] = htmlspecialchars($news['titre']); $liste_news[$cle]['message'] = nl2br(htmlspecialchars($news['message'])); } include_once 'vue/index/index.php'; }
$app->flash('error', 'Login required'); $app->redirect('/backoffice/login'); } }); // Logout $app->get('/logout', function () use($app) { $_SESSION['user'] = ''; session_destroy(); $app->redirect('/backoffice/login'); }); $app->get('/', $authenticate($app), function () use($app) { $app->render('index.php', array('pageTitle' => _('Home'))); }); // Obtem uma lista de todas as noticias $app->get('/noticias', $authenticate($app), function () use($app) { $news = get_news(); $app->render('noticias.php', array('news' => $news, 'pageTitle' => get_setting('noticia_plural'))); }); // Criar uma nova noticia $app->get('/noticia/nova', $authenticate($app), function () use($app) { $app->render('noticia_nova.php', array('pageTitle' => _('Adicionar') . ' ' . get_setting('noticia_singular'))); }); // Guardar noticia $app->post('/noticia/nova', $authenticate($app), function () use($app) { $news = $app->request()->post('news'); save_news($news); $app->redirect('/backoffice/noticias'); }); $app->get('/noticia/editar/:id', $authenticate($app), function ($id) use($app) { $news = get_news_id($id); $app->render('noticia_editar.php', array('news' => $news, 'pageTitle' => _('Editar') . ' ' . get_setting('noticia_singular')));
if (getval("next", "") != "") { $ref++; if ($ref > $maxref) { $ref = $minref; header('location: ' . $baseurl . '/plugins/news/pages/news.php?ref=' . $ref); exit; } } else { $ref--; if ($ref < $minref) { $ref = $maxref; header('location: ' . $baseurl . '/plugins/news/pages/news.php?ref=' . $ref); exit; } } $newsdisplay = get_news($ref, "", ""); } header('location: ' . $baseurl . '/plugins/news/pages/news.php?ref=' . $ref); exit; } include dirname(__FILE__) . "/../../../include/header.php"; ?> <div> <form action="<?php echo $baseurl . '/plugins/news/pages/news.php?ref=' . $ref; ?> " method="post"> <label for="buttons"></label> <input name="previous" type="submit" value="<"/>
} if (!empty($_GET['settr'])) { $settr = strtotime("-" . intval($_GET['settr']) . " day"); $wheresql = empty($wheresql) ? " WHERE a.addtime> " . $settr : $wheresql . " AND a.addtime> " . $settr; $oederbysql = " order BY a.addtime DESC"; } if (intval($_CFG['subsite_id']) > 0) { $wheresql .= empty($wheresql) ? " WHERE " : " AND "; $wheresql .= " a.subsite_id=" . intval($_CFG['subsite_id']) . " "; } $joinsql = " LEFT JOIN " . table('article_category') . " AS c ON a.type_id=c.id LEFT JOIN " . table('article_property') . " AS p ON a.focos=p.id "; $total_sql = "SELECT COUNT(*) AS num FROM " . table('article') . " AS a " . $joinsql . $wheresql; $page = new page(array('total' => $db->get_total($total_sql), 'perpage' => $perpage)); $currenpage = $page->nowindex; $offset = ($currenpage - 1) * $perpage; $article = get_news($offset, $perpage, $joinsql . $wheresql . $oederbysql); $smarty->assign('article', $article); $smarty->assign('page', $page->show(3)); $smarty->assign('pageheader', "新闻资讯"); get_token(); $smarty->display('article/admin_article.htm'); } elseif ($act == 'migrate_article') { $id = $_REQUEST['id']; if (empty($id)) { adminmsg("请选择项目!", 1); } check_token(); check_permissions($_SESSION['admin_purview'], "article_del"); if (del_news($id)) { adminmsg("删除成功!", 2); }
<?php include_once 'includes/db.php'; include_once 'includes/bbcode.php'; include_once 'includes/cache.php'; include_once 'includes/thumbs.php'; include_once 'includes/news.php'; // Prepare newsitems $news = get_news($db); // Get a random welcome image $sql = 'select a.attach_id '; $sql .= 'from phpbb3_attachments as a, phpbb3_topics as t '; $sql .= "where t.forum_id = 33 and a.topic_id = t.topic_id "; $sql .= "and (extension = 'gif' or extension = 'jpg' or extension = 'jpeg' or extension = 'png')"; $sql .= 'order by rand() limit 1'; $res = mysqli_query($db, $sql); $row = mysqli_fetch_array($res); $welcome = '/screenshot.php?id=' . intval($row['attach_id']); // Fetch 4 random screenshots $sql = 'select a.attach_id, physical_filename, topic_title '; $sql .= 'from phpbb3_attachments as a, phpbb3_topics as t '; $sql .= "where t.forum_id = 35 and a.topic_id = t.topic_id "; $sql .= "and (extension = 'gif' or extension = 'jpg' or extension = 'jpeg' or extension = 'png')"; $sql .= 'order by rand() limit 4'; $res = mysqli_query($db, $sql); $rowcount = mysqli_num_rows($res); $screenthumbs = array(); if ($rowcount >= 4) { $screenids = array(); while (count($screenids) < 4) { $proposed = rand(0, $rowcount - 1);
function vcn_load_news() { //cmd/vcn_load_news.html ?> <ul class='list-news'> <?php $news = get_news(array('status' => '1', 'type_' => array('operator' => '!=', 'value' => 'alert-news')), array('limit' => '5')); var_dump($news); while ($result = mysql_fetch_array($news)) { ?> <li><?php if ($result['is_new']) { ?> <img src='http://www.vietcombank.com.vn/images/icons/new.gif'/><?php } ?> <a target='_blank' href='<?php //echo vcn_Url('view-news',$result) ?> '><?php echo $result['title']; ?> </a> - <font color='#808080'><i><?php echo $result['post_time']; ?> </i></font></li> <?php } ?> </ul> <?php }
if ($lang != 'en') { include $path_to_root . "lang/{$lang}/translations.inc"; } // the other languages $channel = array('encoding' => $l_charset_encoding, 'name' => 'KDevelop news', 'url' => $site, 'self_url' => $site . $rss_dir . "kdevelop_news_{$lang}.rss", 'description' => "KDevelop development news ({$languages[$lang]})", 'language' => $lang, 'pub_date' => date("r", $pub_date)); $fp = @fopen($path_to_root . $rss_dir . "kdevelop_news_{$lang}.rss", "w"); @fwrite($fp, create_rss_feed($channel, $rss_items)) or die("File {$news_filename} not writeable"); @fclose($fp); } // Establish a connection with the MySQL server $mysql_link = @mysql_connect("localhost", $k_login, $k_password); // Exit if it canot get a connection to the MySQL database if ($mysql_link == false) { die('Could not connect to the database. Will not be able to create rss news feeds. '); } mysql_select_db("kdevelop_db"); // Make sure the news directory exists if (!file_exists($path_to_root . $news_dir)) { die("The dir <b>\"{$path_to_root}{$news_dir}\"</b> does not exist, please create it\n"); } // Make sure the rss directory exists if (!file_exists($path_to_root . $rss_dir)) { die("The dir <b>\"{$path_to_root}{$rss_dir}\"</b> does not exist, please create it\n"); } // get news $news_items = get_news($news_dir); // build one RSS news feed for each language foreach ($activelanguages as $lang) { build_rss_feed($site, $rss_dir, $lang, $news_items); }
<?php include_once 'model/news/get_news.php'; include_once 'model/news/get_nb_news.php'; $max = 5; if (array_key_exists('goto', $_GET)) { if ($_GET['goto'] < 1) { $pageact = 1; } else { $pageact = $_GET['goto']; } } else { $pageact = 1; } $news = get_news($pageact, $max); $nb_total = get_nb_news(); include 'view/index.php';
if (getval("create","")!="") { header("location:".$baseurl."/plugins/news/pages/news_content_edit.php?ref=new"); } include dirname(__FILE__)."/../../../include/header.php"; ?> <div class="BasicsBox"> <h1><?php echo $lang["news_manage"]?></h1> <h2><?php echo $lang["news_intro"]?></h2> <?php $news=get_news("","",$findtext); # pager $per_page=15; $results=count($news); $totalpages=ceil($results/$per_page); $curpage=floor($offset/$per_page)+1; $url="news_edit.php?findtext=".urlencode($findtext)."&offset=". $offset; $jumpcount=1; ?> <div class="BasicsBox"> <form method="post"> <div class="QuestionSubmit"> <label for="buttons"> </label> <input name="create" type="submit" value="<?php echo $lang["news_add"]?>"/>
// This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // Integria uses icons from famfamfam, licensed under CC Atr. 2.5 // Silk icon set 1.3 (cc) Mark James, http://www.famfamfam.com/lab/icons/silk/ // Integria uses Pear Image::Graph code // Integria shares much of it's code with project Babel Enterprise and Pandora FMS, // also a Free Software Project coded by some of the people who makes Integria. // Set to 1 to do not check for installer or config file (for development!). // Activate gives more error information, not useful for production sites global $config; $options = array(); $options['id_user'] = $config['id_user']; $options['modal'] = true; $news = get_news($options); // Clean subject entities foreach ($news as $k => $v) { $news[$k]['content'] = safe_output($v['content']); $news[$k]['title'] = safe_output($v['title']); } if (!empty($news)) { $options = array(); $options['id'] = 'news_json'; $options['hidden'] = 1; $options['content'] = base64_encode(json_encode($news)); print_div($options); } // Prints news dialog template echo '<div id="news_dialog" title="" style="display: none;">'; echo '<div style="position:absolute; top:30px; left: 10px; text-align: left; right:0%; height:70px; min-width:560px; width: 95%; margin: 0 auto; border: 1px solid #FFF; line-height: 19px;">';
case 'add_news': //добавление новости if ($_POST) { //проверяем были ли переданы данные из формы if (add_news()) { redirect('?view=news'); } else { redirect(); } //иначе редирект на эту же стр, откуда пришли } break; case 'edit_news': //редактирование новости $news_id = (int) $_GET['news_id']; $get_news = get_news($news_id); if ($_POST) { //проверяем были ли переданы данные из формы if (edit_news($news_id)) { redirect('?view=news'); } else { redirect(); } //иначе редирект на эту же стр, откуда пришли } break; case 'del_news': $news_id = (int) $_GET['news_id']; del_news($news_id); redirect(); break;
$index = 0; while ($row = $result->fetch_row()) { $record = array(); $record['date'] = $row[0]; $record['url'] = $row[1]; $record['title'] = $row[2]; $record['body'] = $row[3]; $arr[$index++] = $record; } return $arr; } function get_info($faculty) { $info_str = file_get_contents("../../json/info/" . $faculty . "_info.json"); return json_decode($info_str, true); } if (isset($_GET['faculty'])) { if (isset($_GET['news']) && $_GET['news'] == 'true') { echo json_encode(array('news' => get_news($_GET['faculty']))); } else { if (isset($_GET['news']) && $_GET['news'] == 'false') { echo json_encode(get_info($_GET['faculty'])); } else { $info = get_info($_GET['faculty']); $info['aktuality'] = get_news($_GET['faculty']); echo json_encode($info); } } } else { die("Error"); }
$prebody .= "| <a href=\"admin.php?action=manageusers\">{$txt['316']}</a> "; } if ($PERMISSIONS['Edit_Room'] == 1) { $prebody .= "| <a href=\"admin.php?action=managerooms\">{$txt['317']}</a> "; } if ($PERMISSIONS['Server_Ban'] == 1) { $prebody .= "| <a href=\"admin.php?action=ban\">{$txt['99']}</a> "; } if ($PERMISSIONS['Edit_Bandwidth'] == 1) { $prebody .= "| <a href=\"admin.php?action=bandwidth\">{$txt['428']}</a>"; } $prebody .= "<Br><Br>"; if ($action == "") { $head = "Admin Panel"; // News From Us getter section, to disable see file: x7cread.php include "./x7cread.php"; $special = get_news(); if (!is_array($special)) { $special = $txt[318]; } else { $rspecial = ""; foreach ($special as $key => $val) { $rspecial .= "\n\t\t\t\t<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\">\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=\"50\" height=\"50\" rowspan=\"2\"><img src=\"{$val['icon']}\" width=\"50\" height=\"50\"></td>\n\t\t\t\t\t\t<td width=\"300\" height=\"25\"><font size=\"4\"><b>{$val['title']}</b></font></td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<Tr>\n\t\t\t\t\t\t<td width=\"300\" height=\"25\">By {$val['author']} on {$val['date']}</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td width=\"350\" colspan=\"2\">{$val['body']}</td>\n\t\t\t\t\t</tr>\n\t\t\t\t</table>\n\t\t\t\t<Br><Br>\n\t\t\t"; } } $special = $rspecial; $body = "<font size=6>{$txt['107']}</font><br>{$special}"; } elseif ($action == "settings1") { $head = $txt[296]; if ($SERVER['ENABLE_CHAT'] == 1) { $ENABLE_CHAT = "CHECKED";
function display_news($header = 'h2') { ?> <?php $options = get_option(THEME_OPTIONS_NAME); ?> <?php $count = $options['news_max_items']; ?> <?php $news = get_news(0, $count ? $count : 2); ?> <?php if (count($news)) { ?> <<?php echo $header; ?> ><a href="<?php echo $news[0]->get_feed()->get_link(); ?> "><?php echo $news[0]->get_feed()->get_title(); ?> </a></<?php echo $header; ?> > <ul class="news"> <?php foreach ($news as $key => $item) { $image = get_article_image($item); $first = $key == 0; ?> <li class="item<?php if ($first) { ?> first<?php } else { ?> not-first<?php } ?> "> <h3 class="title"><a href="<?php echo $item->get_link(); ?> " class="ignore-external title"><?php echo $item->get_title(); ?> </a></h3> <p> <a class="image ignore-external" href="<?php echo $item->get_link(); ?> "> <?php if ($image) { ?> <img src="<?php echo $image; ?> " alt="Feed image for <?php echo $item->get_title(); ?> " /> <?php } ?> </a> <a class="description ignore-external" href="<?php echo $item->get_link(); ?> "> <?php echo $item->get_description(); ?> </a> </p> <div class="end"><!-- --></div> </li> <?php } ?> </ul> <div class="end"><!-- --></div> <?php } else { ?> <p>Unable to fetch news.</p> <?php } }
</ul> </div> <label> <div class="col-md-3"> <a href="<?= base_url() . 'uploads/news_covers/' . get_news($trend['item_id'],'image')?>" class="fancybox" title="<?= get_news($trend['item_id'],'title') ?>"> <img class="img-circle" width="32px" height="32px" src="<?= base_url() ?>uploads/news_covers/<?= get_thumbnail(get_news($trend['item_id'],'image')) ?>"> </a> </div> <div class="col-md-9"> <span><?=get_news($trend['item_id'],'title')?></span><br> <small><b>From:</b> <?=custom_date_format('d / M ',$trend['start_date'])?> <br><b>To:</b> <?=custom_date_format('d / M ',$trend['end_date'])?></small> </div> </label> </div> </li> <?php break; case 'careers': echo 'foo'; break; case 'files':
<?php set_time_limit(0); require_once '../includes/init.php'; for ($i = 1; $i < 600; $i++) { get_news('http://www.51766.com/www2009/area/newsmore.jsp?tree_id=29545&pageNum=' . $i, 18); } function get_news($url, $cat_id) { global $db, $prefix; $news = array(); $news['cat_id'] = $cat_id; $news['add_time'] = date('Y-m-d H:i:s'); $news['is_show'] = 1; $html = @file_get_contents($url); //$html = mb_convert_encoding($html, 'UTF-8', 'GBK'); preg_match_all('#<a href="(.*?)" target="_blank" class="blue3 f_sz14">(.*?)</a></span>#i', $html, $matches); for ($i = 0; $i < count($matches[0]); $i++) { //echo "matched: ".$matches[0][$i]."<br />"; $news['from_url'] = $matches[1][$i]; $news['title'] = $matches[2][$i]; $db->insert($prefix . 'article', $news); } echo $url . ' 入库完毕<br />'; flush(); }
function display_footer_news() { $max_news = get_theme_mod_or_default('news_max_items'); $items = get_news(0, $max_news); $placeholder = get_theme_mod_or_default('news_placeholder_image'); ob_start(); ?> <div class="footer-news"> <?php foreach ($items as $key => $item) { $image = get_article_image($item); ?> <a href="<?php echo $item->get_link(); ?> "> <div class="row news-item"> <div class="col-xs-2 col-sm-4 col-md-3"> <div class="news-thumbnail"> <?php if ($image) { ?> <img class="img-responsive" src="<?php echo $image; ?> " alt="Feed image for <?php echo $item->get_title(); ?> "> <?php } else { ?> <img class="img-responsive" src="<?php echo $placeholder; ?> " alt="UCF Today"> <?php } ?> </div> </div> <div class="col-xs-10 col-sm-8 col-md-9"> <div class="news-details"> <h3><?php echo $item->get_title(); ?> </h3> </div> </div> </div> </a> <?php } ?> </div> <?php echo ob_get_clean(); }
$createnews = true; } else { $news = get_news($ref, "", ""); $createnews = false; } if (getval("save", "") != "") { # Save news if ($createnews) { add_news($date, $title, $body); } else { update_news($ref, $date, $title, $body); } redirect("plugins/news/pages/news_edit.php?findtext=" . $findtext . "&offset=" . $offset); } # Fetch news data $news = get_news($ref, "", ""); include dirname(__FILE__) . "/../../../include/header.php"; ?> <p><a href="news_edit.php?offset=<?php echo $offset; ?> &findtext=<?php echo $findtext; ?> ">< <?php echo $lang["news_manage"]; ?> </a></p> <div class="BasicsBox">
public function question() { $code = $this->_get('code'); if (!empty($code)) { $open_id = get_openid($code); } elseif (!empty($_GET['weixin_key'])) { session('weixin_key', $_GET['weixin_key']); } $list = get_news(7, 30, 'id,title,content'); $this->assign('list', $list); $this->display(); }