public function index($arguments) { $news = new news(ConnectionFactory::get('mongo')); $articles = new articles(ConnectionFactory::get('mongo')); $notices = new notices(ConnectionFactory::get('redis')); $irc = new irc(ConnectionFactory::get('redis')); $quotes = new quotes(ConnectionFactory::get('mongo')); $forums = new forums(ConnectionFactory::get('redis')); // Set all site-wide notices. foreach ($notices->getAll() as $notice) { Error::set($notice, true); } // Fetch the easy data. $this->view['news'] = $news->getNewPosts(); $this->view['shortNews'] = $news->getNewPosts(true); $this->view['newArticles'] = $articles->getNewPosts('new', 1, 5); $this->view['ircOnline'] = $irc->getOnline(); $this->view['randomQuote'] = $quotes->getRandom(); $this->view['fPosts'] = $forums->getNew(); // Get online users. $apc = new APCIterator('user', '/' . Cache::PREFIX . 'user_.*/'); $this->view['onlineUsers'] = array(); while ($apc->valid()) { $current = $apc->current(); array_push($this->view['onlineUsers'], substr($current['key'], strlen(Cache::PREFIX) + 5)); $apc->next(); } // Set title. Layout::set('title', 'Home'); }
/** * @package pragyan * @copyright (c) 2008 Pragyan Team * @license http://www.gnu.org/licenses/ GNU Public License * For more details, see README */ function displayNews() { $news = <<<NEWS \t\t<style type="text/css"> \t\ta.tickl{font-family:Verdana,Arial,Helvetica,sans-serif;font-size:11px;line-height:12px;text-decoration:none;color:#fff;font-weight:bold;} \t\t.tickls{color:#666;} \t\t</style> \t\t<div id="newsbox" style="font-size:0.9em;position:absolute;right:45px;width:375px;top:80px;color:#fff;z-index:2;"> \t\t<div class="ticki" > \t\t<a class="tickl" href="/08/home/news/"><span class="tickls">UPDATES</span></a> \t\t<a id="tickerAnchor" class="tickl" target="_top" href=""></a> \t\t</div> \t\t</div> \t\t<script type="text/javascript" language="JavaScript"> \t\t <!-- \t\t var theCharacterTimeout = 50; \t\t var theStoryTimeout = 5000; \t\t var theWidgetOne = "_"; \t\t var theWidgetTwo = "-"; \t\t var theWidgetNone = ""; \t\t var theLeadString = ": "; \t\t var theSummaries = new Array(); \t\t var theSiteLinks = new Array(); NEWS; global $sourceFolder; global $moduleFolder; global $urlRequestRoot; global $pageIdArray; require_once "{$sourceFolder}/{$moduleFolder}/news.lib.php"; $tmpNewsObj = new news(); $pageFullPath = "/news/"; ///<Replace with path of news page $pageId = parseUrlReal($pageFullPath, $pageIdArray); $pageInfo = getPageInfo($pageId); $newsArray = $tmpNewsObj->getNewsArray($pageInfo['page_modulecomponentid']); $news .= "var theItemCount =" . sizeof($newsArray) . ";"; for ($i = 0; $i < sizeof($newsArray); $i++) { $newsFeed = $newsArray[$i]['news_title']; $newsFeed .= " - " . $newsArray[$i]['news_feed']; $newsLink = $newsArray[$i]['news_link']; // displayerror() if (strlen($newsFeed) >= 48) { $newsFeed = substr($newsFeed, 0, 48); $newsFeed = substr($newsFeed, 0, strrpos($newsFeed, " ")); $newsFeed .= "..."; } $news .= "theSummaries[{$i}] = \"{$newsFeed}\";"; if ($newsLink == "") { $newsLink = $urlRequestRoot . $pageFullPath . "&id=" . $newsArray[$i]['news_id']; } $news .= "theSiteLinks[{$i}] = \"{$newsLink}\";"; } $news .= <<<NEWS \t\t startTicker(); \t\t //--> \t\t</script> NEWS; return $news; }
public function index($arguments) { Layout::set('title', 'Search'); if (empty($_POST['query'])) { return Error::set('No search query found.'); } $query = substr(trim(htmlentities($_POST['query'], ENT_QUOTES, 'ISO8859-1', false)), 0, 250); $results = Search::query($query); if ($results['hits']['total'] == 0) { return Error::set('No results found.'); } $this->view['results'] = array(); $news = new news(ConnectionFactory::get('mongo')); $articles = new articles(ConnectionFactory::get('mongo')); $lectures = new lectures(ConnectionFactory::get('mongo')); $i = 1; if (empty($results['hits']['hits'])) { return; } foreach ($results['hits']['hits'] as $result) { $entry = $result['_source']; switch ($entry['type']) { case 'news': $post = $news->get($result['_id'], false, true); if (empty($post)) { continue; } $post['type'] = 'news'; array_push($this->view['results'], $post); break; case 'article': $article = $articles->get($result['_id'], false, true); if (empty($article)) { continue; } $article['type'] = 'article'; array_push($this->view['results'], $article); break; case 'lecture': $lecture = $lectures->get($result['_id'], false, true); if (empty($lecture)) { continue; } $lecture['type'] = 'lecture'; array_push($this->view['results'], $lecture); break; } if ($i == 5) { break; } ++$i; } }
public function load(ObjectManager $manager) { $information = new Information(); $information->setTitle("About Me"); $information->setBody("<p>Rofilde Hasudungan research are in DNA based Computer</p>"); $information->setPublished(true); $manager->persist($information); $news = new news(); $news->setTitle("About Me"); $news->setBody("<p>Rofilde Hasudungan research are in DNA based Computer</p>"); $news->setPublished(true); $manager->persist($news); $manager->flush(); }
if ($mode == 'own') { $where = 'news.author=' . $_SESSION['userid']; } $query = 'news.id, news.active, news.start, news.end, news.author, person.first_name as author_first_name, person.last_name as author_last_name, news.topic, news.text from news join person on
public function pageNews() { $lang = services::getService('lang'); $params = services::getService('pageParams'); $this->page(); $this->setTemplate('news.tpl'); // newsscript: show news headlines $shownews = new news(); $shownews->id = $params->getParam('news_id'); $shownews->find(true); $this->shownews = array('name' => $shownews->name, 'abstract' => $shownews->abstract, 'text' => $shownews->text, 'date' => date('d. m. Y', $shownews->date), 'id' => $shownews->id); // output $this->assignAll(); $this->display(); }
public function actionGetArticle($view) { $article_id = (int) $_GET['article']; $article = news::getArticle($article_id); $view->article = $article; echo $view->render('article.php'); }
/** * Public function that creates a single instance */ public static function getInstance() { if (!isset(self::$_instance)) { self::$_instance = new self(); } return self::$_instance; }
public function vote($arguments) { if (!CheckAcl::can('voteOnNews')) { return Error::set('You can not vote on news posts.'); } if (empty($arguments[0]) || empty($arguments[1])) { return Error::set('Vote or news id not found.'); } $news = new news(ConnectionFactory::get('mongo')); $result = $news->castVote($arguments[0], $arguments[1]); $post = $news->get($arguments[0], false, true); if (is_string($result)) { return Error::set($result, false, array('Back' => Url::format('/news/view/' . Id::create($post, 'news')))); } Error::set('Vote cast!', true, array('Back' => Url::format('/news/view/' . Id::create($post, 'news')))); }
public function actionAll() { $news = news::getAll(); $view = new view(); $view->items = $news; $view->display('news/all.php'); }
function get_cha() { if ($_GET['module'] == 'news') { if (intval($_GET['cha']) > 0) { return intval($_GET['cha']); } elseif (intval($_GET['cat']) > 0) { $cat = new category_news(); $row = $cat->detail($_GET['cat']); return $row['cha_id']; } elseif (intval($_GET['id']) > 0) { $news = new news(); $row = $news->detail('cha_id', $_GET['id']); return $row['cha_id']; } } else { return 0; } }
function displayNew() { global $sourceFolder; global $moduleFolder; global $urlRequestRoot; global $pageIdArray; require_once "{$sourceFolder}/{$moduleFolder}/news.lib.php"; $tmpNewsObj = new news(); $pageFullPath = "/whatsnew/"; ///<Replace with path of news page $pageId = parseUrlReal($pageFullPath, $pageIdArray); $pageInfo = getPageInfo($pageId); $newsArray = $tmpNewsObj->getNewsArray($pageInfo['page_modulecomponentid']); $newsFeed = ''; for ($i = 0; $i < sizeof($newsArray); $i++) { $newsTitle = str_replace("'", "'", $newsArray[$i]['news_title']); $newsBody = str_replace("'", "'", $newsArray[$i]['news_feed']); $newsTitle = rtrim($newsTitle); $newsBody = rtrim($newsBody); $days = 20; // if(time()<(strtotime($newsArray[$i]['news_date'])+($days*24*60*60))) { // $newsBody .= '<font color="#f9dc72"><strong> NEW!</strong></font>'; // } if ($newsArray[$i]['news_link'] == '') { $newsFeed .= '\'<a href=/09/home/whatsnew>' . $newsTitle . ' ' . $newsBody . '</a>\','; } else { $newsFeed .= '\'<a href=' . $newsArray[$i]['news_link'] . '>' . $newsTitle . ' ' . $newsBody . '</a>\','; } } $newsFeed = rtrim($newsFeed, ','); /** if (strlen($newsFeed) >= 48) { $newsFeed = substr($newsFeed, 0, 48); $newsFeed = substr($newsFeed, 0, strrpos($newsFeed, " ")); $newsFeed .= "..."; } */ $news = <<<NEWS <script> var pausecontent2=new Array({$newsFeed}) </script> NEWS; return $news; }
public static function load($view_rep, $view_file) { if (tg('_tsk') == 'news') { $instance = new news(); $array = $instance->index(); } if (isset($array)) { $titre = lg('TITR') . ' | ' . $array['titre']; $content = htmlentities($array['titre']); $image = "http://{$_SERVER['HTTP_HOST']}" . criimg_link('upload/news/' . $array['img'], 200, 200, 'PNG'); $actual_link = "http://{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}"; } else { $titre = lg('TITR'); $content = 'Site Internet Officiel de la présidence de la République du Tchad.'; $image = './img/header.jpg'; $actual_link = "http://{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}"; } include_once AFFICH_REP . 'layout/header.php'; include_once AFFICH_REP . 'layout/limen.php'; include_once AFFICH_REP . $view_rep . SLASH . $view_file . '_v.php'; }
/** * @package pragyan * @copyright (c) 2008 Pragyan Team * @license http://www.gnu.org/licenses/ GNU Public License * For more details, see README */ function displayNews2() { global $sourceFolder; global $moduleFolder; global $urlRequestRoot; global $pageIdArray; require_once "{$sourceFolder}/{$moduleFolder}/news.lib.php"; $tmpNewsObj = new news(); $pageFullPath = "/news/"; ///<Replace with path of news page $pageId = parseUrlReal($pageFullPath, $pageIdArray); $pageInfo = getPageInfo($pageId); $newsArray = $tmpNewsObj->getNewsArray(0); for ($i = 0; $i < sizeof($newsArray); $i++) { $divopen = "<div class=\"news_style\" rel=\"{$newsArray[$i]}[news_title]\" id=\"news{$i}\">"; $heading = "<h4>{$newsArray[$i]}[news_title]</h4>"; $content = "{$newsArray[$i]}[news_feed]"; $divclose = "</div>"; $fulldiv = $divopen . $heading . $content . $divclose; echo $fulldiv; } return 1; }
} $smarty->assign("T_FORUM_OPTIONS", $forum_options); //Assign forum options to smarty /*Lesson announcements list*/ if (!isset($currentUser->coreAccess['news']) || $currentUser->coreAccess['news'] != 'hidden') { if (!empty($lessons_list)) { if ($currentUser->getType() == "student") { //See only non-expired news $news = news::getNews(0, true) + news::getNews($lessons_list, true); } else { //See both expired and non-expired news $news = news::getNews(0, true) + news::getNews($lessons_list, false); } } else { //Administrator news, he doesn't have to see lesson news (since he can't actually access them) $news = news::getNews(0, true); } $news = array_slice($news, 0, 10, true); $smarty->assign("T_NEWS", $news); //Assign announcements to smarty } /*Comments list*/ if (!empty($lessons_list)) { $comments = eF_getTableData("comments cm JOIN content c JOIN lessons l ON c.lessons_ID = l.id", "cm.id AS id, cm.data AS data, cm.users_LOGIN AS users_LOGIN, cm.timestamp AS timestamp, c.name AS content_name, c.id AS content_ID, c.ctg_type AS content_type, l.name as show_lessons_name, l.id as show_lessons_id", "c.lessons_ID IN ('" . implode("','", $lessons_list) . "') AND cm.content_ID=c.id AND c.active=1 AND cm.active=1 AND cm.private=0", "cm.timestamp DESC LIMIT 5"); if ($_SESSION['s_type'] != 'administrator' && $_SESSION['s_current_branch']) { //this applies to supervisors only $currentBranch = new EfrontBranch($_SESSION['s_current_branch']); $branchTreeUsers = array_keys($currentBranch->getBranchTreeUsers()); foreach ($comments as $key => $value) { if (!in_array($value['users_LOGIN'], $branchTreeUsers)) { unset($comments[$key]);
if ($action == 'all' || $action == 'cat') { $sub_action = intval(varset($tmp[1], 0)); } if ($action == 'extend' && empty($sub_action)) { $defaultUrl = e107::getUrl()->create('news/list/items'); e107::getRedirect()->go($defaultUrl, null, 301); exit; } /* Variables Used: $action - the basic display format/filter $sub_action - category number or news item number $newsfrom - first item number in list (default 0) - derived from nextprev $order - sets the listing order for 'list' format */ $ix = new news(); $nobody_regexp = "'(^|,)(" . str_replace(",", "|", e_UC_NOBODY) . ")(,|\$)'"; // URL settings (nextprev) $newsUrlparms = array('page' => '--FROM--'); if ($sub_action) { switch ($action) { case 'list': $newsUrlparms['id'] = $sub_action; $newsRoute = 'list/category'; break; case 'cat': $newsUrlparms['id'] = $sub_action; $newsRoute = 'list/short'; break; case 'day': case 'month':
<div class="table"> <div class="nav"> <label class="active">新闻列表</label> <a href="add.html"><label>添加新闻</label></a> </div> <div class="form"> <table cellspacing="0px" class="admins"> <tr> <th width="100">新闻编号</th> <th width="200">标题</th> <th width="300">内容</th> <th width="200">操作</th> </tr> <?php require "model.php"; $news = new news(); $result = $news->selectAll(); foreach ($result as $item) { ?> <tr> <td class="id"><?php echo $item->id; ?> </td> <td><?php echo $item->title; ?> </td> <td><?php echo $item->content; ?>
/// /// [Copyright] /// Copyright 2007-2008 prolove. All rights reserved. /// /// [Filename] /// 学生项目申请首页类 /// /// [Description] /// 学生项目申请首页类页面 /// /// [History] /// Date Version Author Content /// ---------- ------- -------- ------------------------------------ /// 2009/11/16 1.1 龙首成 学生管理 require_once "news.class.php"; $news = new news(); $noticdata = $news->getNotice(); $id = intval($_GET['id']); $news->setTableName('notic'); $data = $news->selectA(array('notic_id' => $id)); $title = "通知 > " . $data[0]['notic_title']; require_once "header.php"; ?> <div id="right" style="width:648px;border:#C1C1C1 solid 1px;background-color:#FFF0F0;float:left"> <div id="item" style="border:#c1c1c1 solid 1px;margin-bottom:20px;text-align:center"> <h3 style="color:red"><?php echo $data[0]['notic_title']; ?> </h3> <p>发布时间:<?php
<?php defined('IN_DESTOON') or exit('Access Denied'); login(); require DT_ROOT . '/module/' . $module . '/common.inc.php'; if ($_groupid > 5 && !$_edittime && $action == 'add') { dheader($MODULE[2]['linkurl'] . 'edit.php?tab=2'); } $MG['homepage'] && $MG['news_limit'] > -1 or dalert(lang('message->without_permission_and_upgrade'), 'goback'); require DT_ROOT . '/include/post.func.php'; $TYPE = get_type('news-' . $_userid); require MD_ROOT . '/news.class.php'; $do = new news(); switch ($action) { case 'add': if ($MG['news_limit']) { $r = $db->get_one("SELECT COUNT(*) AS num FROM {$DT_PRE}news WHERE username='******' AND status>0"); if ($r['num'] >= $MG['news_limit']) { dalert(lang($L['limit_add'], array($MG['news_limit'], $r['num'])), 'goback'); } } if ($submit) { if ($do->pass($post)) { $post['username'] = $_username; $post['level'] = $post['addtime'] = 0; $need_check = $MOD['news_check'] == 2 ? $MG['check'] : $MOD['news_check']; $post['status'] = get_status(3, $need_check); $do->add($post); dmsg($L['op_add_success'], '?status=' . $post['status']); } else { message($do->errmsg);
$model = $_REQUEST['model']; $action = $_REQUEST['action']; include_once MODELS_ADMIN . "/" . $model . "_model.php"; switch (strtoupper($action)) { case 'ADD': break; case 'SAVE': $objNews = new news(); $objNews->setNews($_REQUEST); $objComm->redirect('index.php?model=' . $model); break; case 'VIEW': case 'EDIT': $objNews = new news(); $row = $objNews->getNews($_REQUEST['id']); break; case 'UPDATE': $objNews = new news(); $objNews->setNews($_REQUEST); $objComm->redirect('index.php?model=' . $model . '&action=edit&id=' . $_REQUEST['pk_id']); break; case 'DELETE': $objNews = new news(); $objNews->delNews($_REQUEST['id']); $objComm->redirect('index.php?model=' . $model); break; default: $objNews = new news(); $Records = $objNews->getAllNews(); break; }
<?php require_once "model.php"; $type = $_GET['type']; $first = $_GET['first'] ? $_GET['first'] : 0; $news = new news(); echo $news->select("news", $first);
</div> <?php } } else { ?> <p><?php echo Kohana::lang('search.no_result'); ?> </p> <?php } ?> <hr /> <? // Rendering news results ?> <h2><?php echo Kohana::lang('search.results_for_news'); ?> </h2> <?php if (count($data3) > 0) { ?> <? echo news::items($data3); ?> <?php } else { ?> <p><?php echo Kohana::lang('search.no_result'); ?> </p> <?php }
$text = $p->t('news/mailtext'); $texthtml = $p->t('news/mailtextHTML', array(APP_ROOT . "cms/newsverwaltung.php?news_id=" . $news_id, $content->titel, $_POST['text_' . DEFAULT_LANGUAGE])); $mail = new mail($to, $from, $subject, $text); $mail->setHTMLContent($texthtml); if ($mail->send()) { $message .= '<br><span class="ok">' . $p->t('news/uebersetzungsanforderungGesendet', array($to)) . '</span>'; } else { $message .= '<br><span class="error">' . $p->t('news/fehlerBeimSenden', array($to)) . '</span>'; } } else { $message .= '<br><span class="error">' . $p->t('news/keinUebersetzerVorhanden') . '</span>'; } } } $sprachen = array(DEFAULT_LANGUAGE); $news = new news(); if ($news_id != '') { $news->load($news_id); $sprachen = $content->getLanguages($news->content_id); $studiengang_kz = $news->studiengang_kz; $semester = $news->semester; if ($studiengang_kz == '0' && $semester == '' && !$berechtigt) { die($p->t('global/keineBerechtigungFuerDieseSeite')); } } if ($studiengang_kz == '0' && $semester == '') { $type = $p->t('news/allgemein'); } elseif ($studiengang_kz == '0' && $semester == '0') { $type = $p->t('news/freifach'); } else { $type = $p->t('news/studiengang');
private function getRssSource($source, $mode, $lesson) { $feeds = $this->getProvidedFeeds(); foreach ($feeds as $value) { if ($value['active'] && $value['mode'] == 'system') { $systemFeeds[$value['type']] = $value; } else { if ($value['active'] && $value['mode'] == 'lesson') { $lessonFeeds[$value['type']] = $value; } } } if ($mode == 'system' && !in_array($source, array_keys($systemFeeds))) { return array(); } elseif ($mode == 'lesson' && !in_array($source, array_keys($lessonFeeds))) { return array(); } $data = array(); switch ($source) { case 'announcements': if ($mode == 'system') { $news = news::getNews(0, true); } elseif ($mode == 'lesson') { if ($lesson) { $news = news::getNews($lesson, true); } else { $lessons = eF_getTableDataFlat("lessons", "id, name"); $lessonNames = array_combine($lessons['id'], $lessons['name']); $news = news::getNews($lessons['id'], true); } } $count = 1; foreach ($news as $value) { if ($mode == 'lesson' && !$lesson) { $value['title'] = $lessonNames[$value['lessons_ID']] . ': ' . $value['title']; $link = G_SERVERNAME . 'userpage.php?lessons_ID=' . $value['lessons_ID'] . '&ctg=news&view=' . $value['id']; } else { $link = G_SERVERNAME . 'userpage.php?ctg=news&view=' . $value['id']; } $data[] = array('title' => $value['title'], 'link' => $link, 'description' => $value['data']); /* if ($count++ == $this -> feedLimit) { break; } */ } break; case 'catalog': $constraints = array("return_objects" => false, 'archive' => false, 'active' => true); $result = EfrontCourse::getAllCourses($constraints); $directionsTree = new EfrontDirectionsTree(); $directionPaths = $directionsTree->toPathString(); foreach ($result as $value) { $pathString = $directionPaths[$value['directions_ID']] . ' → ' . $value['name']; $data[] = array('title' => $pathString, 'link' => G_SERVERNAME . 'index.php?ctg=lesson_info&courses_ID=' . $value['id'], 'description' => implode("<br>", unserialize($value['info']))); } $result = eF_getTableData("lessons", "id,name,directions_ID, info", "archive=0 and instance_source = 0 and active=1 and course_only=0", "name"); foreach ($result as $value) { $pathString = $directionPaths[$value['directions_ID']] . ' → ' . $value['name']; $data[] = array('title' => $pathString, 'link' => G_SERVERNAME . 'index.php?ctg=lesson_info&lessons_ID=' . $value['id'], 'description' => implode("<br>", unserialize($value['info']))); } $data = array_values(eF_multisort($data, 'title', 'asc')); //Sort results based on path string break; case 'calendar': if ($mode == 'system') { $events = calendar::getGlobalCalendarEvents(); } elseif ($mode == 'lesson') { if ($lesson) { $events = calendar::getLessonCalendarEvents($lesson); } else { $events = calendar::getCalendarEventsForAllLessons(); } } foreach ($events as $value) { $value['name'] ? $title = formatTimestamp($value['timestamp']) . ' (' . $value['name'] . ')' : ($title = formatTimestamp($value['timestamp'])); $data[] = array('title' => $title, 'link' => G_SERVERNAME . 'userpage.php?ctg=calendar&view_calendar=' . $value['timestamp'] . '&type=0', 'description' => $value['data']); } break; /* case 'history': $currentUser = $this -> getCurrentUser(); $eventObjects = array(); $result = eF_getTableData("events", "*", "", "timestamp DESC limit 100"); foreach ($result as $value) { $eventObject = new EfrontEvent($value); $eventObject -> createMessage(); pr($eventObject); } break; */ /* case 'history': $currentUser = $this -> getCurrentUser(); $eventObjects = array(); $result = eF_getTableData("events", "*", "", "timestamp DESC limit 100"); foreach ($result as $value) { $eventObject = new EfrontEvent($value); $eventObject -> createMessage(); pr($eventObject); } break; */ case 'structure': if ($lesson) { $contentTree = new EfrontContentTree($lesson); $contentPath = $contentTree->toPathStrings(); foreach ($contentPath as $key => $value) { $data[] = array('title' => $value, 'link' => G_SERVERNAME . 'userpage.php?lessons_ID=' . $lesson . '&unit=' . $key, 'description' => $value); } } break; case 'forum': if ($mode == 'system') { $result = eF_getTableData("f_messages fm JOIN f_topics ft JOIN f_forums ff LEFT OUTER JOIN lessons l ON ff.lessons_ID = l.id", "ff.title as forum_name, fm.body, fm.title, fm.id, ft.id as topic_id, ft.title as topic_title, fm.users_LOGIN, fm.timestamp, l.name as lessons_name, lessons_id as show_lessons_id", "ft.f_forums_ID=ff.id AND fm.f_topics_ID=ft.id ", "fm.timestamp desc LIMIT 100"); } elseif ($mode == 'lesson') { if ($lesson) { $result = eF_getTableData("f_messages fm JOIN f_topics ft JOIN f_forums ff LEFT OUTER JOIN lessons l ON ff.lessons_ID = l.id", "ff.title as forum_name, fm.body, fm.title, fm.id, ft.id as topic_id, ft.title as topic_title, fm.users_LOGIN, fm.timestamp, l.name as lessons_name, lessons_id as show_lessons_id", "ft.f_forums_ID=ff.id AND fm.f_topics_ID=ft.id AND ff.lessons_ID = '" . $lesson . "'", "fm.timestamp desc LIMIT 100"); } else { $result = eF_getTableData("f_messages fm JOIN f_topics ft JOIN f_forums ff LEFT OUTER JOIN lessons l ON ff.lessons_ID = l.id", "ff.title as forum_name, fm.body, fm.title, fm.id, ft.id as topic_id, ft.title as topic_title, fm.users_LOGIN, fm.timestamp, l.name as lessons_name, lessons_id as show_lessons_id", "ft.f_forums_ID=ff.id AND fm.f_topics_ID=ft.id AND ff.lessons_ID != 0", "fm.timestamp desc LIMIT 100"); } } foreach ($result as $value) { $value['title'] = $value['forum_name'] . ' >> ' . $value['topic_title'] . ' >> ' . $value['title']; if ($mode == 'system' && $value['lessons_name'] || $mode == 'lesson' && !$lesson) { $value['title'] = $value['lessons_name'] . ': ' . $value['title']; } $data[] = array('title' => $value['title'], 'link' => G_SERVERNAME . 'userpage.php?ctg=forum&topic=' . $value['topic_id'], 'description' => $value['body']); } break; default: break; } return $data; }
} if (!$smarty->is_cached('index.tpl', $cacheId) || !$GLOBALS['configuration']['smarty_caching']) { foreach (eF_loadAllModules(true, true) as $module) { $module->onIndexPageLoad(); } $positions = $GLOBALS['currentTheme']->layout['positions']; //Main scripts, such as prototype $mainScripts = getMainScripts(); $smarty->assign("T_HEADER_MAIN_SCRIPTS", implode(",", $mainScripts)); //Operation/file specific scripts $loadScripts = array_diff($loadScripts, $mainScripts); //Clear out duplicates $smarty->assign("T_HEADER_LOAD_SCRIPTS", implode(",", array_unique($loadScripts))); //array_unique, so it doesn't send duplicate entries if (in_array('news', array_merge($positions['leftList'], $positions['rightList'], $positions['centerList']))) { $smarty->assign("T_NEWS", news::getNews(0, true)); } if (G_VERSIONTYPE == 'enterprise') { #cpp#ifdef ENTERPRISE require_once "../libraries/module_hcd_tools.php"; } #cpp#endif if (EfrontUser::isOptionVisible('online_users') && in_array('online', array_merge($positions['leftList'], $positions['rightList'], $positions['centerList']))) { $smarty->assign("T_ONLINE_USERS_LIST", EfrontUser::getUsersOnline($GLOBALS['configuration']['autologout_time'] * 60)); } $smarty->assign("T_CURRENT_USER", $currentUser); $smarty->load_filter('output', 'eF_template_setEditorOffset'); $smarty->display('index.tpl'); } else { $smarty->load_filter('output', 'eF_template_setEditorOffset'); $smarty->display('index.tpl');
/** * Initialize lesson * * This function is used to initialize specific aspects of the current lesson * These aspects can be the lesson content, announcements, users, glossary etc * specified in the $deleteEntities array. * <br/>Example: * <code> * try { * $lesson = new EfrontLesson(32); //32 is the lesson id * $lesson -> initialize(array('content', 'glossary', 'rules')); //Erase all content, glossary terms and content rules * } catch (Exception $e) { * echo $e -> getMessage(); * } * </code><br/> * If $deleteEntities is 'all', then all lesson aspects are reset * * @param mixed $deleteEntities Eiterh an array with lesson aspects to initialize, or 'all' which equals to 'reset everything' * @return boolean True if everything is ok * @since 3.5.0 * @access public */ public function initialize($deleteEntities) { $possibleEntities = array('content', 'tests', 'questions', 'rules', 'conditions', 'comments', 'users', 'news', 'files', 'calendar', 'glossary', 'tracking', 'scheduling', 'surveys', 'events', 'modules', 'projects'); if ($deleteEntities == 'all') { $deleteEntities = $possibleEntities; } $content = eF_getTableDataFlat("content", "*", "lessons_ID=" . $this->lesson['id']); //Get the lesson units sizeof($content['id']) > 0 ? $content_list = implode(",", $content['id']) : ($content_list = array()); //Create list of content ids, will come in handy later $commonFolderLessons = eF_getTableData("lessons", "id", "share_folder=" . $this->lesson['id']); foreach ($deleteEntities as $value) { switch ($value) { case 'tests': $lessonTests = $this->getTests(true); foreach ($lessonTests as $id => $test) { $test->delete(); } break; case 'questions': $lessonQuestions = $this->getQuestions(true); foreach ($lessonQuestions as $id => $question) { $question->delete(); } break; case 'rules': $content = new EfrontContentTree($this->lesson['id']); $contentRules = $content->getRules(); $content->deleteRules(array_keys($contentRules)); break; case 'conditions': $lessonConditions = $this->getConditions(); $this->deleteConditions(array_keys($lessonConditions)); break; case 'comments': $content = new EfrontContentTree($this->lesson['id']); $content->deleteComments(array_keys($content->getComments())); //Delete all comments break; case 'content': $content = new EfrontContentTree($this->lesson['id']); foreach (new EfrontNodeFilterIterator(new RecursiveIteratorIterator(new RecursiveArrayIterator($content->tree), RecursiveIteratorIterator::SELF_FIRST)) as $key => $unit) { $unit->delete(); } break; case 'users': $lessonUsers = $this->getUsers('student'); $this->removeUsers(array_keys($lessonUsers)); break; case 'news': $lessonNews = news::getNews($this->lesson['id']); //$this -> getNews(); foreach ($lessonNews as $value) { $value = new news($value); $value->delete(); } break; case 'files': //Only delete files if this lesson is not sharing its folder if (!$this->lesson['share_folder'] && empty($commonFolderLessons)) { $directory = new EfrontDirectory($this->directory); $directory->delete(); mkdir($this->directory, 0755); } break; case 'calendar': !in_array('calendar', $deleteEntities) or calendar::deleteLessonCalendarEvents($this->lesson['id']); break; case 'glossary': in_array('glossary', $deleteEntities) ? eF_deleteTableData("glossary", "lessons_ID=" . $this->lesson['id']) : null; break; case 'projects': $lessonProjects = $this->getProjects(true); foreach ($lessonProjects as $value) { $value->delete(); } break; case 'tracking': $tracking_info = array("done_content" => "", "issued_certificate" => "", "comments" => "", "completed" => 0, "current_unit" => 0, "score" => 0); eF_updateTableData("users_to_lessons", $tracking_info, "lessons_ID = " . $this->lesson['id']); /* foreach ($this -> getUsers as $user => $foo) { $cacheKey = "user_lesson_status:lesson:".$this -> lesson['id']."user:"******"completed_tests", "tests_ID={$id}"); } $units = $this->getUnits(); if (sizeof($units) > 0) { eF_deleteTableData("scorm_data", "content_ID in (" . implode(",", $units) . ")"); } break; case 'scheduling': $this->lesson['from_timestamp'] = null; $this->lesson['to_timestamp'] = null; $this->persist(); break; case 'surveys': $surveys = eF_getTableDataFlat("surveys", "id", "lessons_ID=" . $this->lesson['id']); $surveys_list = implode(",", $surveys['id']); if (!empty($surveys_list)) { eF_deleteTableData("questions_to_surveys", "surveys_ID IN ({$surveys_list})"); eF_deleteTableData("survey_questions_done", "surveys_ID IN ({$surveys_list})"); eF_deleteTableData("users_to_surveys", "surveys_ID IN ({$surveys_list})"); eF_deleteTableData("users_to_done_surveys", "surveys_ID IN ({$surveys_list})"); eF_deleteTableData("surveys", "lessons_ID=" . $this->lesson['id']); } break; case 'events': eF_deleteTableData("events", "lessons_ID=" . $this->lesson['id']); break; case 'modules': $modules = eF_loadAllModules(); foreach ($modules as $module) { $module->onDeleteLesson($this->lesson['id']); } break; } EfrontCache::getInstance()->deleteCache(); } /* if (in_array('questions', $deleteEntities)) { //Delete lesson questions $result = eF_getTableData("questions", "id", "lessons_ID=".$this -> lesson['id']); foreach ($result as $value) { $questionIds[] = $value['id']; } if (sizeof($questionIds) > 0) { eF_deleteTableData("tests_to_questions", "questions_ID in (".implode(",", $questionIds).")"); } eF_deleteTableData("questions", "lessons_ID=".$this -> lesson['id']); } if (in_array('content', $deleteEntities)) { //Delete lesson units foreach ($content['id'] as $value) { $value = new EfrontUnit($value); $value -> delete(); } $result = eF_getTableDataFlat("content", "id", "lessons_ID=".$this -> lesson['id']); $list = implode(",", $result['id']); EfrontSearch :: removeText('content', $list, '', true); eF_deleteTableData("content", "lessons_ID=".$this -> lesson['id']); //Just make sure everything is deleted } if (in_array('surveys', $deleteEntities)) { $surveys = eF_getTableDataFlat("surveys", "id", "lessons_ID=".$this -> lesson['id']); $surveys_list = implode(",", $surveys['id']); eF_deleteTableData("questions_to_surveys", "surveys_ID IN ($surveys_list)"); eF_deleteTableData("survey_questions_done", "surveys_ID IN ($surveys_list)"); eF_deleteTableData("users_to_surveys", "surveys_ID IN ($surveys_list)"); eF_deleteTableData("users_to_done_surveys", "surveys_ID IN ($surveys_list)"); eF_deleteTableData("surveys", "lessons_ID=".$this -> lesson['id']); } if (in_array('tracking', $deleteEntities)) { $tracking_info = array("done_content" => "", "issued_certificate" => "", "comments" => "", "completed" => 0, "current_unit" => 0, "score" => 0); eF_updateTableData("users_to_lessons", $tracking_info, "lessons_ID = ".$this -> lesson['id']); } if (in_array('files', $deleteEntities)) { $filesystem = new FileSystemTree($this -> getDirectory()); foreach (new ArrayIterator($filesystem -> tree) as $key => $value) { $value -> delete(); } } in_array('conditions', $deleteEntities) ? eF_deleteTableData("lesson_conditions", "lessons_ID=".$this -> lesson['id']) : null; in_array('calendar', $deleteEntities) ? eF_deleteTableData("calendar", "lessons_ID=".$this -> lesson['id']) : null; in_array('periods', $deleteEntities) ? eF_deleteTableData("periods", "lessons_ID=".$this -> lesson['id']) : null; in_array('news', $deleteEntities) ? eF_deleteTableData("news", "lessons_ID=".$this -> lesson['id']) : null; in_array('glossary', $deleteEntities) ? eF_deleteTableData("glossary", "lessons_ID=".$this -> lesson['id']) : null; in_array('users', $deleteEntities) ? eF_deleteTableData("users_to_lessons", "lessons_ID=".$this -> lesson['id']." and user_type = 'student'") : null; in_array('comments', $deleteEntities) ? eF_deleteTableData("comments", "content_ID IN (".$content_list.")") : null; in_array('rules', $deleteEntities) ? eF_deleteTableData("rules", "content_ID IN (".$content_list.") or rule_content_ID IN (".$content_list.")") : null; $done_tests = eF_getTableDataFlat("done_tests", "id", "tests_ID IN ($content_list)"); sizeof($done_tests) > 0 ? eF_deleteTableData("done_questions", "done_tests_ID IN (".implode(",", $done_tests['id']).")") : null; eF_deleteTableData("done_tests", "tests_ID IN ($content_list)"); eF_deleteTableData("users_to_done_tests", "tests_ID IN ($content_list)"); eF_deleteTableData("logs", "action='test_begin' AND comments IN ($content_list)"); */ }
/// /// [Copyright] /// Copyright 2007-2008 prolove. All rights reserved. /// /// [Filename] /// 学生项目申请首页类 /// /// [Description] /// 学生项目申请首页类页面 /// /// [History] /// Date Version Author Content /// ---------- ------- -------- ------------------------------------ /// 2009/11/16 1.1 龙首成 学生管理 require_once "news.class.php"; $news = new news(); $pageno = $_GET['page_no']; $newsshow = $news->getnewsinfo($pageno); $noticdata = $news->getNotice(); $title = "新闻列表"; require_once "header.php"; ?> <div id="right" style="width:648px;height:300px;border:#C1C1C1 solid 1px;background-color:#FFF0F0;float:left"> <div id="item" style="border:#c1c1c1 solid 1px;height:40px;margin-bottom:20px;text-align:center"> <span style="float:left;width:630px"><h3>新闻列表</h3></span> </div> <div id="content" style="width:560px;margin:auto;"> <ul style="line-height:18px;"> <?php
* $Date$ * $Author$ */ if (!defined('e107_INIT')) { exit; } global $e107cache; // Load Data if ($cacheData = $e107cache->retrieve("nq_othernews")) { echo $cacheData; return; } require_once e_HANDLER . "news_class.php"; unset($text); global $OTHERNEWS_STYLE; $ix = new news(); if (!$OTHERNEWS_STYLE) { $OTHERNEWS_STYLE = "\n\t<div style='padding:3px;width:100%'>\n\t<table style='border-bottom:1px solid black;width:100%' cellpadding='0' cellspacing='0'>\n\t<tr>\n\t<td style='vertical-align:top;padding:3px;width:20px'>\n\t{NEWSCATICON}\n\t</td><td style='text-align:left;padding:3px;vertical-align:top'>\n\t{NEWSTITLELINK}\n\t</td></tr></table>\n\t</div>\n"; } if (!defined("OTHERNEWS_LIMIT")) { define("OTHERNEWS_LIMIT", 10); } if (!defined("OTHERNEWS_ITEMLINK")) { define("OTHERNEWS_ITEMLINK", ""); } if (!defined("OTHERNEWS_CATLINK")) { define("OTHERNEWS_CATLINK", ""); } if (!defined("OTHERNEWS_THUMB")) { define("OTHERNEWS_THUMB", "border:0px"); }
function date() { system::setParam("page", "blogByDate"); $offset = 1; if (isset($this->get["offset"])) { $offset = intval($this->get["offset"]); } $cacheID = "DTSELECT|ARTICLE|dateoffset_{$offset}"; if (isset($this->args[1])) { $date = preg_replace("/[^0-9.]/uims", '', $this->args[1]); $cacheID = $date . "|" . $cacheID; } $this->smarty->setCacheID($cacheID); if (!$this->smarty->isCached()) { $allCount = $this->db->query("SELECT COUNT(*) as cnt FROM `content` as c, `content_category` as cc, `categories` as cts WHERE \n cc.`contentID`=c.`contentID` AND c.`type`='article' AND cts.`categoryID`=cc.`catID` AND c.`showOnSite`='Y' AND c.`dt` >= \n STR_TO_DATE ('?', '%d.%m.%Y')", $date)->fetch(); $posts = news::getPostsByDate($date, core::pagination($allCount["cnt"], $offset), "article")->fetchAll(); $this->smarty->assign("posts", $posts); $this->smarty->assign("date", $date); } }
if (isset($pref['trackbackEnabled']) && $pref['trackbackEnabled']) { $query = "SELECT COUNT(tb.trackback_pid) AS tb_count, n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_name, nc.category_icon FROM #news AS n\n\t\t\t\t\tLEFT JOIN #user AS u ON n.news_author = u.user_id\n\t\t\t\t\tLEFT JOIN #news_category AS nc ON n.news_category = nc.category_id\n\t\t\t\t\tLEFT JOIN #trackback AS tb ON tb.trackback_pid = n.news_id\n\t\t\t\t\tWHERE n.news_class REGEXP '" . e_CLASS_REGEXP . "'\n\t\t\t\t\tAND n.news_id={$id}\n\t\t\t\t\tAND n.news_allow_comments=0\n\t\t\t\t\tGROUP by n.news_id"; } else { $query = "SELECT n.*, u.user_id, u.user_name, u.user_customtitle, nc.category_name, nc.category_icon FROM #news AS n\n\t\t\t\t\tLEFT JOIN #user AS u ON n.news_author = u.user_id\n\t\t\t\t\tLEFT JOIN #news_category AS nc ON n.news_category = nc.category_id\n\t\t\t\t\tWHERE n.news_class REGEXP '" . e_CLASS_REGEXP . "'\n\t\t\t\t\tAND n.news_id={$id}\n\t\t\t\t\tAND n.news_allow_comments=0"; } if (!$sql->db_Select_gen($query)) { e107::redirect(); exit; } else { $news = $sql->db_Fetch(); $subject = $tp->toForm($news['news_title']); define("e_PAGETITLE", "{$subject} - " . COMLAN_100 . " / " . LAN_COMMENTS); require_once HEADERF; ob_start(); $comment_ob_start = TRUE; $ix = new news(); $ix->render_newsitem($news, "extend"); // extend so that news-title-only news text is displayed in full when viewing comments. $field = $news['news_id']; } break; case 'poll': if (!$sql->db_Select("polls", "*", "poll_id='{$id}'")) { e107::redirect(); exit; } else { $row = $sql->db_Fetch(); $comments_poll = $row['poll_comment']; $subject = $row['poll_title']; define("e_PAGETITLE", $subject . ' - ' . COMLAN_101 . " / " . LAN_COMMENTS); $poll_to_show = $id;