本文整理汇总了PHP中newArticle函数的典型用法代码示例。如果您正苦于以下问题:PHP newArticle函数的具体用法?PHP newArticle怎么用?PHP newArticle使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了newArticle函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getAllTagsFromZenpage
/**
* Gets all tags used by either all Zenpage news articles or pages.
* @param string $mode "news" for Zenpage news article tags, "pages" for Zenpage pages tags
*
*/
function getAllTagsFromZenpage($mode = 'news')
{
global $_zp_gallery, $_zp_CMS;
if (!extensionEnabled('zenpage')) {
return FALSE;
}
$passwordcheck = '';
$ids = array();
$where = '';
$tagWhere = "";
switch ($mode) {
case 'news':
if (zp_loggedin(ZENPAGE_NEWS_RIGHTS | ALL_NEWS_RIGHTS)) {
$published = 'all';
} else {
$published = 'published';
}
$type = 'news';
$items = $_zp_CMS->getArticles(false, $published);
foreach ($items as $item) {
$obj = newArticle($item['titlelink']);
if ($obj->checkAccess()) {
$ids[] = $obj->getID();
}
}
break;
case 'pages':
$published = !zp_loggedin(ZENPAGE_NEWS_RIGHTS | ALL_NEWS_RIGHTS);
$type = 'pages';
$items = $_zp_CMS->getPages($published);
foreach ($items as $item) {
$obj = newPage($item['titlelink']);
if ($obj->checkAccess()) {
$ids[] = $obj->getID();
}
}
break;
}
$count = '';
if (count($ids) == 0) {
return FALSE;
} else {
$tagWhere = " WHERE ";
foreach ($ids as $id) {
$count++;
$tagWhere .= '(o.objectid =' . $id . " AND o.tagid = t.id AND o.type = '" . $type . "')";
if ($count != count($ids)) {
$tagWhere .= " OR ";
}
}
}
if (empty($tagWhere)) {
return FALSE;
} else {
$tags = query_full_array("SELECT DISTINCT t.name, t.id, (SELECT DISTINCT COUNT(*) FROM " . prefix('obj_to_tag') . " WHERE tagid = t.id AND o.type = '" . $type . "') AS count FROM " . prefix('obj_to_tag') . " AS o," . prefix('tags') . " AS t" . $tagWhere . " ORDER BY t.name");
}
return $tags;
}
示例2: getitems
public function getitems()
{
$items = array();
if ($album = @$this->options['album']) {
if ($image = @$this->options['image']) {
if (!is_array($image)) {
$image = array($image);
}
foreach ($image as $filename) {
$obj = newImage(array('folder' => $album, 'filename' => $filename), true, true);
if ($obj->exists) {
$items[] = $obj;
}
}
} else {
if (!is_array($album)) {
$album = array($album);
}
foreach ($album as $folder) {
$obj = newAlbum($folder, true);
if ($obj->exists) {
$items[] = $obj;
}
}
}
return $items;
}
if ($this->feedtype == 'news' && ($news = @$this->options['titlelink'])) {
if (!is_array($news)) {
$news = array($news);
}
foreach ($news as $article) {
$obj = newArticle($article, false);
if ($obj->loaded) {
$items[] = array('titlelink' => $article);
}
}
return $items;
}
if ($this->feedtype == 'pages' && ($pages = @$this->options['titlelink'])) {
if (!is_array($pages)) {
$pages = array($pages);
}
foreach ($pages as $page) {
$obj = newPage($page, false);
if ($obj->loaded) {
$items[] = array('titlelink' => $page);
}
}
return $items;
}
return parent::getitems();
}
示例3: getLatestZenpageComments
/**
* Gets latest comments for news articles and pages
*
* @param int $number how many comments you want.
* @param string $type "all" for all latest comments for all news articles and all pages
* "news" for the lastest comments of one specific news article
* "page" for the lastest comments of one specific page
* @param int $itemID the ID of the element to get the comments for if $type != "all"
*/
function getLatestZenpageComments($number, $type = "all", $itemID = "")
{
$itemID = sanitize_numeric($itemID);
$number = sanitize_numeric($number);
$checkauth = zp_loggedin();
if ($type == 'all' || $type == 'news') {
$newspasswordcheck = "";
if (zp_loggedin(MANAGE_ALL_NEWS_RIGHTS)) {
$newsshow = '';
} else {
$newsshow = 'news.show=1 AND';
$newscheck = query_full_array("SELECT * FROM " . prefix('news') . " ORDER BY date");
foreach ($newscheck as $articlecheck) {
$obj = newArticle($articlecheck['titlelink']);
if ($obj->inProtectedCategory()) {
if ($checkauth && $obj->isMyItem(LIST_RIGHTS)) {
$newsshow = '';
} else {
$excludenews = " AND id != " . $articlecheck['id'];
$newspasswordcheck = $newspasswordcheck . $excludenews;
}
}
}
}
}
if ($type == 'all' || $type == 'page') {
$pagepasswordcheck = "";
if (zp_loggedin(MANAGE_ALL_PAGES_RIGHTS)) {
$pagesshow = '';
} else {
$pagesshow = 'pages.show=1 AND';
$pagescheck = query_full_array("SELECT * FROM " . prefix('pages') . " ORDER BY date");
foreach ($pagescheck as $pagecheck) {
$obj = newPage($pagecheck['titlelink']);
if ($obj->isProtected()) {
if ($checkauth && $obj->isMyItem(LIST_RIGHTS)) {
$pagesshow = '';
} else {
$excludepages = " AND pages.id != " . $pagecheck['id'];
$pagepasswordcheck = $pagepasswordcheck . $excludepages;
}
}
}
}
}
switch (strtolower($type)) {
case "news":
$whereNews = " WHERE {$newsshow} news.id = " . $itemID . " AND c.ownerid = news.id AND c.type = 'news' AND c.private = 0 AND c.inmoderation = 0" . $newspasswordcheck;
break;
case "page":
$wherePages = " WHERE {$pagesshow} pages.id = " . $itemID . " AND c.ownerid = pages.id AND c.type = 'pages' AND c.private = 0 AND c.inmoderation = 0" . $pagepasswordcheck;
break;
case "all":
$whereNews = " WHERE {$newsshow} c.ownerid = news.id AND c.type = 'news' AND c.private = 0 AND c.inmoderation = 0" . $newspasswordcheck;
$wherePages = " WHERE {$pagesshow} c.ownerid = pages.id AND c.type = 'pages' AND c.private = 0 AND c.inmoderation = 0" . $pagepasswordcheck;
break;
}
$comments_news = array();
$comments_pages = array();
if ($type == "all" or $type == "news") {
$comments_news = query_full_array("SELECT c.id, c.name, c.type, c.website," . " c.date, c.anon, c.comment, news.title, news.titlelink FROM " . prefix('comments') . " AS c, " . prefix('news') . " AS news " . $whereNews . " ORDER BY c.id DESC LIMIT {$number}");
}
if ($type == "all" or $type == "page") {
$comments_pages = query_full_array($sql = "SELECT c.id, c.name, c.type, c.website," . " c.date, c.anon, c.comment, pages.title, pages.titlelink FROM " . prefix('comments') . " AS c, " . prefix('pages') . " AS pages " . $wherePages . " ORDER BY c.id DESC LIMIT {$number}");
}
$comments = array();
foreach ($comments_news as $comment) {
$comments[$comment['id']] = $comment;
}
foreach ($comments_pages as $comment) {
$comments[$comment['id']] = $comment;
}
krsort($comments);
return array_slice($comments, 0, $number);
}
示例4: getItemByID
/**
* Gets an item object by id
*
* @param string $table database table to search
* @param int $id id of the item to get
* @return mixed
*/
function getItemByID($table, $id)
{
if ($result = query_single_row('SELECT * FROM ' . prefix($table) . ' WHERE id =' . (int) $id)) {
switch ($table) {
case 'images':
if ($alb = getItemByID('albums', $result['albumid'])) {
return newImage($alb, $result['filename'], true);
}
break;
case 'albums':
return newAlbum($result['folder'], false, true);
case 'news':
return newArticle($result['titlelink']);
case 'pages':
return newPage($result['titlelink']);
case 'news_categories':
return new Category($result['titlelink']);
}
}
return NULL;
}
示例5: getitemComments
/**
* Gets the feed item data in a comments feed
*
* @param array $item Array of a comment
* @return array
*/
protected function getitemComments($item)
{
if ($item['anon']) {
$author = "";
} else {
$author = " " . gettext("by") . " " . $item['name'];
}
$commentpath = $imagetag = $title = '';
switch ($item['type']) {
case 'images':
$title = get_language_string($item['title']);
$obj = newImage(array('folder' => $item['folder'], 'filename' => $item['filename']));
$link = $obj->getlink();
$feeditem['pubdate'] = date("r", strtotime($item['date']));
$category = get_language_string($item['albumtitle']);
$website = $item['website'];
$title = $category . ": " . $title;
$commentpath = PROTOCOL . '://' . $this->host . $link . "#" . $item['id'];
break;
case 'albums':
$obj = newAlbum($item['folder']);
$link = rtrim($obj->getLink(), '/');
$feeditem['pubdate'] = date("r", strtotime($item['date']));
$title = get_language_string($item['albumtitle']);
$website = $item['website'];
$commentpath = PROTOCOL . '://' . $this->host . $link . "#" . $item['id'];
break;
case 'news':
case 'pages':
if (extensionEnabled('zenpage')) {
$feeditem['pubdate'] = date("r", strtotime($item['date']));
$category = '';
$title = get_language_string($item['title']);
$titlelink = $item['titlelink'];
$website = $item['website'];
if ($item['type'] == 'news') {
$obj = newArticle($titlelink);
} else {
$obj = newPage($titlelink);
}
$commentpath = PROTOCOL . '://' . $this->host . html_encode($obj->getLink()) . "#" . $item['id'];
} else {
$commentpath = '';
}
break;
}
$feeditem['title'] = getBare($title . $author);
$feeditem['link'] = $commentpath;
$feeditem['desc'] = $item['comment'];
return $feeditem;
}
示例6: getSitemapNewsArticles
/**
* Gets to the Zenpage news articles
*
* @param string $changefreq One of the supported changefrequence values regarding sitemap.org. Default is empty or wrong is "daily".
* @return string
*/
function getSitemapNewsArticles()
{
global $_zp_CMS, $sitemap_number;
//not splitted into several sitemaps yet
if ($sitemap_number == 1) {
$data = '';
$sitemap_locales = generateLanguageList();
$changefreq = getOption('sitemap_changefreq_news');
$articles = $_zp_CMS->getArticles('', 'published', true, "date", "desc");
if ($articles) {
$data .= sitemap_echonl('<?xml version="1.0" encoding="UTF-8"?>');
$data .= sitemap_echonl('<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">');
foreach ($articles as $article) {
$articleobj = newArticle($article['titlelink']);
$lastchange = $date = substr($articleobj->getPublishDate(), 0, 10);
if (!is_null($articleobj->getLastchange())) {
$lastchange = substr($articleobj->getLastchange(), 0, 10);
}
if ($date > $lastchange) {
$date = $lastchange;
}
if (!$articleobj->inProtectedCategory()) {
$base = $articleobj->getLink();
switch (SITEMAP_LOCALE_TYPE) {
case 1:
foreach ($sitemap_locales as $locale) {
$url = str_replace(WEBPATH, seo_locale::localePath(true, $locale), $base);
$data .= sitemap_echonl("\t<url>\n\t\t<loc>" . $url . "</loc>\n\t\t<lastmod>" . $date . "</lastmod>\n\t\t<changefreq>" . $changefreq . "</changefreq>\n\t\t<priority>0.9</priority>\n\t</url>");
}
break;
case 2:
foreach ($sitemap_locales as $locale) {
$url = dynamic_locale::fullHostPath($locale) . $base;
$data .= sitemap_echonl("\t<url>\n\t\t<loc>" . $url . "</loc>\n\t\t<lastmod>" . $date . "</lastmod>\n\t\t<changefreq>" . $changefreq . "</changefreq>\n\t\t<priority>0.9</priority>\n\t</url>");
}
break;
default:
$url = FULLHOSTPATH . $base;
$data .= sitemap_echonl("\t<url>\n\t\t<loc>" . $url . "</loc>\n\t\t<lastmod>" . $date . "</lastmod>\n\t\t<changefreq>" . $changefreq . "</changefreq>\n\t\t<priority>0.9</priority>\n\t</url>");
break;
}
}
}
$data .= sitemap_echonl('</urlset>');
// End off the <urlset> tag
}
return $data;
}
}
示例7: publishArticle
/**
*
* Creates the news article
* @param object $obj
*/
protected static function publishArticle($obj, $override = NULL)
{
global $_zp_CMS;
$galleryitem_text = array();
$locale = getOption('locale');
switch ($type = $obj->table) {
case 'albums':
$album = $obj->name;
$dbstring = getOption('galleryArticles_album_text');
$localtext = get_language_string($dbstring);
$galleryitem_text[$locale] = sprintf($localtext, $obj->getTitle($locale));
foreach (generateLanguageList() as $key) {
$languagetext = get_language_string($dbstring, $key);
if ($localtext != $languagetext) {
$galleryitem_text[$key] = sprintf($languagetext, $obj->getTitle($key));
}
}
$ref = '"' . $album . '"';
$title = $folder = $album;
$img = $obj->getAlbumThumbImage();
$class = 'galleryarticles-newalbum';
break;
case 'images':
$album = $obj->album->name;
$image = $obj->filename;
$dbstring = unserialize(getOption('galleryArticles_image_text'));
$localtext = get_language_string($dbstring);
$galleryitem_text[$locale] = sprintf($localtext, $obj->getTitle($locale), $obj->album->getTitle($locale));
foreach (generateLanguageList() as $key => $val) {
$languagetext = get_language_string($dbstring, $key);
if ($localtext != $languagetext) {
$galleryitem_text[$key] = sprintf($localtext, $obj->getTitle($key), $obj->album->getTitle($key));
}
}
$ref = '"' . $album . '" "' . $image . '"';
$folder = $obj->imagefolder;
$title = $folder . '-' . $image;
$img = $obj;
$class = 'galleryarticles-newimage';
break;
default:
//not a gallery object
return;
}
$article = newArticle(seoFriendly('galleryArticles-' . $title));
$article->setTitle(serialize($galleryitem_text));
$imglink = $img->getCustomImage(getOption('galleryArticles_size'), NULL, NULL, NULL, NULL, NULL, NULL, -1);
$desc = '<p><a class="' . $class . '" href="' . $obj->getLink() . '"><img src="' . $imglink . '"></a></p><p>[GALLERYARTICLEDESC ' . $ref . ']</p>';
$article->setContent($desc);
$date = $obj->getPublishDate();
if (!$date) {
$date = date('Y-m-d H:i:s');
}
$article->setDateTime($date);
$article->setLastchange(date('Y-m-d H:i:s'));
$article->setAuthor('galleryArticles');
$article->setLastchangeauthor('galleryArticles');
$article->setShow(true);
$article->save();
if ($override) {
$cat = $override;
} else {
$cat = getOption('galleryArticles_category');
if (getOption('galleryArticles_albumCategory')) {
$catlist = $_zp_CMS->getAllCategories();
foreach ($catlist as $category) {
if ($category['titlelink'] == $folder) {
$cat = $category['titlelink'];
break;
}
}
}
}
$article->setCategories(array($cat));
}
示例8: gettext
</th>
<th><?php
echo gettext('Expires');
?>
</th>
<th class="subhead" colspan="8">
<label style="float: right"><?php
echo gettext("Check All");
?>
<input type="checkbox" name="allbox" id="allbox" onclick="checkAll(this.form, 'ids[]', this.checked);" />
</label>
</th>
</tr>
<?php
foreach ($result as $article) {
$article = newArticle($article['titlelink']);
?>
<tr class="newstr">
<td>
<?php
switch ($article->getSticky()) {
case 1:
$sticky = ' <small>[' . gettext('sticky') . ']</small>';
break;
case 9:
$sticky = ' <small><strong>[' . gettext('sticky') . ']</strong></small>';
break;
default:
$sticky = '';
break;
}
示例9: getLatestNews
</h3>
</div>
</div>
<?php
}
?>
<?php
$_zp_current_album = NULL;
?>
</div>
<br style="clear:both;" /><br />
<h3 class="searchheader" >Latest words</h3>
<?php
$ln = getLatestNews(3);
foreach ($ln as $n) {
$_zp_current_article = newArticle($n['titlelink']);
?>
<div class="newsarticlewrapper"><div class="newsarticle" style="border-width: 0;">
<h3><?php
printNewsURL();
?>
</h3>
<div class="newsarticlecredit"><span class="newsarticlecredit-left"><?php
printNewsDate();
?>
| <?php
echo gettext("Comments:");
?>
<?php
示例10: getItemNews
/**
* Gets the feed item data in a Zenpage news feed
*
* @param array $item Titlelink a Zenpage article or filename of an image if a combined feed
* @return array
*/
protected function getItemNews($item)
{
$categories = '';
$feeditem['enclosure'] = '';
$obj = newArticle($item['titlelink']);
$title = $feeditem['title'] = get_language_string($obj->getTitle('all'), $this->locale);
$link = $obj->getLink();
$count2 = 0;
$plaincategories = $obj->getCategories();
$categories = '';
foreach ($plaincategories as $cat) {
$catobj = newCategory($cat['titlelink']);
$categories .= get_language_string($catobj->getTitle('all'), $this->locale) . ', ';
}
$categories = rtrim($categories, ', ');
$feeditem['desc'] = shortenContent($obj->getContent($this->locale), getOption('RSS_truncate_length'), '...');
if (!empty($categories)) {
$feeditem['category'] = html_encode($categories);
$feeditem['title'] = $title . ' (' . $categories . ')';
}
$feeditem['link'] = PROTOCOL . '://' . $this->host . $link;
$feeditem['media_content'] = '';
$feeditem['media_thumbnail'] = '';
$feeditem['pubdate'] = date("r", strtotime($item['date']));
return $feeditem;
}
示例11: copy
/**
* duplicates an article
* @param string $newtitle the title for the new article
*/
function copy($newtitle)
{
$newID = $newtitle;
$id = parent::copy(array('titlelink' => $newID));
if (!$id) {
$newID = $newtitle . ':' . seoFriendly(date('Y-m-d_H-i-s'));
$id = parent::copy(array('titlelink' => $newID));
}
if ($id) {
$newobj = newArticle($newID);
$newobj->setTitle($newtitle);
$newobj->setTags($this->getTags(false));
$newobj->setDateTime('');
$newobj->setShow(0);
$newobj->save();
$categories = array();
foreach ($this->getCategories() as $cat) {
$categories[] = $cat['cat_id'];
}
$result = query_full_array("SELECT * FROM " . prefix('news_categories') . " ORDER BY titlelink");
foreach ($result as $cat) {
if (in_array($cat['id'], $categories)) {
query("INSERT INTO " . prefix('news2cat') . " (cat_id, news_id) VALUES ('" . $cat['id'] . "', '" . $id . "')");
}
}
return $newobj;
}
return false;
}
示例12: printRelatedItems
/**
* Prints the x related articles based on a tag search
*
* @param int $number Number of items to get
* @param string $type 'albums', 'images','news','pages', "all" for all combined.
* @param string $specific If $type = 'albums' or 'images' name of album
* @param bool $excerpt If a text excerpt (gallery items: description; Zenpage items: content) should be shown. NULL for none or number of length
* @param bool $thumb For $type = 'albums' or 'images' if a thumb should be shown (default size as set on the options)
*/
function printRelatedItems($number = 5, $type = 'news', $specific = NULL, $excerpt = NULL, $thumb = false, $date = false)
{
global $_zp_gallery, $_zp_current_album, $_zp_current_image;
$label = array('albums' => gettext('Albums'), 'images' => gettext('Images'), 'news' => gettext('News'), 'pages' => gettext('Pages'));
$result = getRelatedItems($type, $specific);
$resultcount = count($result);
if ($resultcount != 0) {
?>
<h3 class="relateditems">
<?php
printf(gettext('Related %s'), $type);
?>
</h3>
<ul id="relateditems">
<?php
$count = 0;
foreach ($result as $item) {
$count++;
?>
<li class="<?php
echo $item['type'];
?>
">
<?php
$category = '';
switch ($item['type']) {
case 'albums':
$obj = newAlbum($item['name']);
$url = $obj->getLink();
$text = $obj->getDesc();
$category = gettext('Album');
break;
case 'images':
$alb = newAlbum($item['album']);
$obj = newImage($alb, $item['name']);
$url = $obj->getLink();
$text = $obj->getDesc();
$category = gettext('Image');
break;
case 'news':
$obj = newArticle($item['name']);
$url = $obj->getLink();
$text = $obj->getContent();
$category = gettext('News');
break;
case 'pages':
$obj = newPage($item['name']);
$url = $obj->getLink();
$text = $obj->getContent();
$category = gettext('Page');
break;
}
?>
<?php
if ($thumb) {
$thumburl = false;
switch ($item['type']) {
case 'albums':
$thumburl = $obj->getThumb();
break;
case 'images':
$thumburl = $obj->getThumb();
break;
}
if ($thumburl) {
?>
<a href="<?php
echo html_encode(pathurlencode($url));
?>
" title="<?php
echo html_encode($obj->getTitle());
?>
" class="relateditems_thumb">
<img src="<?php
echo html_encode(pathurlencode($thumburl));
?>
" alt="<?php
echo html_encode($obj->getTitle());
?>
" />
</a>
<?php
}
}
?>
<h4><a href="<?php
echo html_encode(pathurlencode($url));
?>
" title="<?php
echo html_encode($obj->getTitle());
?>
//.........这里部分代码省略.........
示例13: processZenpageBulkActions
/**
* Processes the check box bulk actions
*
*/
function processZenpageBulkActions($type)
{
global $_zp_CMS;
$action = false;
if (isset($_POST['ids'])) {
//echo "action for checked items:". $_POST['checkallaction'];
$action = sanitize($_POST['checkallaction']);
switch ($type) {
case 'Article':
$table = 'news';
break;
case 'Page':
$table = 'pages';
break;
case 'Category':
$table = 'news_categories';
break;
}
$result = zp_apply_filter('processBulkCMSSave', NULL, $action, $table);
$links = sanitize($_POST['ids']);
$total = count($links);
$message = NULL;
$sql = '';
if ($action != 'noaction') {
if ($total > 0) {
if ($action == 'addtags' || $action == 'alltags') {
$tags = bulkTags();
}
if ($action == 'addcats') {
if (isset($_POST['addcategories'])) {
$cats = sanitize($_POST['addcategories']);
} else {
$cats = array();
}
}
$n = 0;
foreach ($links as $titlelink) {
$obj = new $type($titlelink);
if (is_null($result)) {
switch ($action) {
case 'deleteall':
$obj->remove();
break;
case 'addtags':
$mytags = array_unique(array_merge($tags, $obj->getTags(false)));
$obj->setTags($mytags);
break;
case 'cleartags':
$obj->setTags(array());
break;
case 'alltags':
$allarticles = $obj->getArticles('', 'all', true);
foreach ($allarticles as $article) {
$newsobj = newArticle($article['titlelink']);
$mytags = array_unique(array_merge($tags, $newsobj->getTags(false)));
$newsobj->setTags($mytags);
$newsobj->save();
}
break;
case 'clearalltags':
$allarticles = $obj->getArticles('', 'all', true);
foreach ($allarticles as $article) {
$newsobj = newArticle($article['titlelink']);
$newsobj->setTags(array());
$newsobj->save();
}
break;
case 'addcats':
$catarray = array();
$allcats = $obj->getCategories();
foreach ($cats as $cat) {
$catitem = $_zp_CMS->getCategory($cat);
$catarray[] = $catitem['titlelink'];
//to use the setCategories method we need an array with just the titlelinks!
}
$allcatsarray = array();
foreach ($allcats as $allcat) {
$allcatsarray[] = $allcat['titlelink'];
//same here!
}
$mycats = array_unique(array_merge($catarray, $allcatsarray));
$obj->setCategories($mycats);
break;
case 'clearcats':
$obj->setCategories(array());
break;
case 'showall':
$obj->setShow(1);
break;
case 'hideall':
$obj->setShow(0);
break;
case 'commentson':
$obj->setCommentsAllowed(1);
break;
case 'commentsoff':
//.........这里部分代码省略.........
示例14: gettext
</form>
</div>
<?php
} else {
echo gettext('No unpublished categories');
}
?>
</fieldset>
<br class="clearall" />
<?php
$visible = $report == 'news';
$items = $_zp_CMS->getArticles(0, false);
$output = '';
$c = 0;
foreach ($items as $key => $item) {
$itemobj = newArticle($item['titlelink']);
if (!$itemobj->getShow()) {
$c++;
$output .= '<li><label><input type="checkbox" name="' . $item['titlelink'] . '" value="' . $item['titlelink'] . '" class="catcheck" />' . $itemobj->getTitle() . '</label>';
if ($desc = shortenContent($itemobj->getContent(), 50, '...')) {
$output .= ' "' . strip_tags($desc) . '"';
}
$output .= ' <a href="' . html_encode($itemobj->getLink()) . '" title="' . html_encode($itemobj->getTitle()) . '">(' . gettext('View') . ') </a><a href="' . WEBPATH . '/' . ZENFOLDER . '/' . PLUGIN_FOLDER . '/zenpage/admin-edit.php?newscategory&titlelink=' . html_encode($itemobj->getTitlelink()) . '">(' . gettext('Edit') . ')</a></li>';
}
}
?>
<fieldset class="smallbox">
<legend><?php
if ($c > 0) {
reveal('newsbox', $visible);
}
示例15: header
if ($action == "admin") {
//
//require_once("adminArt.html");
if (!isset($_SESSION["name"])) {
header("Location: DTTadmin.php?a=login");
} else {
$adminArt = $_GET["b"];
//if null
switch ($adminArt) {
case null:
header("Location: index.php");
break;
case "add":
$admin = file_get_contents("widgetAdmin.html");
echo setTitle($template, "New Article", $admin);
echo newArticle();
echo setFoot($link);
break;
case "check":
$save = isset($_POST["save"]) ? $_POST["save"] : null;
$update = isset($_POST["update"]) ? $_POST["update"] : null;
$cancel = isset($_POST["cancel"]) ? $_POST["cancel"] : null;
if (isset($save)) {
$title = $_POST["artTit"];
$sumary = $_POST["sumary"];
$content = $_POST["Article"];
$date = $_POST["date"];
//who expects the own admin injectin bad querys?
$query = $pdo->prepare("INSERT INTO articleTable (title, sumary, article, publishdate) VALUES ('{$title}', '{$sumary}', '{$content}', '{$date}')");
$query->execute();
header("Location: DTTadmin.php?a=admin");