1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-17 12:48:24 +01:00

News & eURL - work in progress

This commit is contained in:
secretr 2008-12-02 16:50:16 +00:00
parent f5de93cf98
commit 91a116c3bd
4 changed files with 110 additions and 91 deletions

View File

@ -1,21 +1,17 @@
<?php
/*
+---------------------------------------------------------------+
| e107 website system
|
| ©Steve Dunstan 2001-2002
| http://e107.org
| jalist@e107.org
|
| Released under the terms and conditions of the
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_admin/newspost.php,v $
| $Revision: 1.16 $
| $Date: 2008-11-11 13:26:49 $
| $Author: secretr $
+---------------------------------------------------------------+
* e107 website system
*
* Copyright (C) 2001-2008 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
* News Administration
*
* $Source: /cvs_backup/e107_0.8/e107_admin/newspost.php,v $
* $Revision: 1.17 $
* $Date: 2008-12-02 16:50:16 $
* $Author: secretr $
*/
require_once("../class2.php");
@ -57,7 +53,7 @@ $rs = new form;
$ix = new news;
if (e_QUERY)
if (e_QUERY)
{
$tmp = explode(".", e_QUERY);
$action = $tmp[0];
@ -126,7 +122,7 @@ if($delete == "sn" && $del_id)
}
if (isset($_POST['submitupload']))
if (isset($_POST['submitupload']))
{
$pref['upload_storagetype'] = "1";
require_once(e_HANDLER."upload_handler.php");
@ -151,7 +147,7 @@ if (isset($_POST['submitupload']))
// required.
if (isset($_POST['preview']))
if (isset($_POST['preview']))
{
$_POST['news_title'] = $tp->toDB($_POST['news_title']);
$_POST['news_summary'] = $tp->toDB($_POST['news_summary']);
@ -159,7 +155,7 @@ if (isset($_POST['preview']))
}
if (isset($_POST['submit_news']))
if (isset($_POST['submit_news']))
{
$newspost->submit_item($sub_action, $id);
$e107cache->clear("news.php");
@ -199,7 +195,7 @@ if (isset($_POST['update_category'])) {
$e107cache->clear("othernews2");
}
if (isset($_POST['save_prefs']))
if (isset($_POST['save_prefs']))
{
$pref['newsposts'] = $_POST['newsposts'];
$pref['newsposts_archive'] = $_POST['newsposts_archive'];
@ -223,16 +219,16 @@ if (isset($_POST['save_prefs']))
$newspost->show_message(NWSLAN_119);
}
if (!e_QUERY || $action == "main")
if (!e_QUERY || $action == "main")
{
$newspost->show_existing_items($action, $sub_action, $sort_order, $from, $amount);
}
if ($action == "create")
if ($action == "create")
{
$preset = $pst->read_preset("admin_newspost"); //only works here because $_POST is used.
if ($sub_action == "edit" && !$_POST['preview'] && !$_POST['submit_news'])
if ($sub_action == "edit" && !$_POST['preview'] && !$_POST['submit_news'])
{
if ($sql->db_Select("news", "*", "news_id='$id' "))
{
@ -261,21 +257,21 @@ if ($action == "create")
if ($action == "cat")
if ($action == "cat")
{
$newspost->show_categories($sub_action, $id);
}
if ($action == "sn")
if ($action == "sn")
{
$newspost->submitted_news($sub_action, $id);
}
if ($action == "pref")
if ($action == "pref")
{
$newspost->show_news_prefs($sub_action, $id);
}
@ -296,7 +292,7 @@ exit;
class newspost
class newspost
{
function show_existing_items($action, $sub_action, $sort_order, $from, $amount)
@ -308,7 +304,7 @@ class newspost
if (!$sort_order) $sort_order = 'desc';
if ($sort_order != 'asc') $sort_order = 'desc';
$sort_link = $sort_order == 'asc' ? 'desc' : 'asc'; // Effectively toggle setting for headings
if (isset($_POST['searchquery']))
{
$query = "news_title REGEXP('".$_POST['searchquery']."') OR news_body REGEXP('".$_POST['searchquery']."') OR news_extended REGEXP('".$_POST['searchquery']."') ORDER BY news_datestamp DESC";
@ -415,12 +411,12 @@ class newspost
function create_item($sub_action, $id)
{
global $cal;
// ##### Display creation form
// ##### Display creation form
global $sql, $rs, $ns, $pref, $tp, $pst, $e107;
if ($sub_action == "sn" && !$_POST['preview'])
if ($sub_action == "sn" && !$_POST['preview'])
{
if ($sql->db_Select("submitnews", "*", "submitnews_id=$id", TRUE))
if ($sql->db_Select("submitnews", "*", "submitnews_id=$id", TRUE))
{
list($id, $submitnews_name, $submitnews_email, $_POST['news_title'], $submitnews_category, $_POST['data'], $submitnews_datestamp, $submitnews_ip, $submitnews_auth, $submitnews_file) = $sql->db_Fetch();
@ -440,7 +436,7 @@ class newspost
}
}
if ($sub_action == "upload" && !$_POST['preview'])
if ($sub_action == "upload" && !$_POST['preview'])
{
if ($sql->db_Select("upload", "*", "upload_id=$id")) {
$row = $sql->db_Fetch();
@ -1172,12 +1168,12 @@ class newspost
function submitted_news($sub_action, $id)
function submitted_news($sub_action, $id)
{
global $rs, $ns, $tp;
$sql2 = new db;
$text = "<div style='text-align: center'>";
if ($category_total = $sql2->db_Select("submitnews", "*", "submitnews_id !='' ORDER BY submitnews_id DESC"))
if ($category_total = $sql2->db_Select("submitnews", "*", "submitnews_id !='' ORDER BY submitnews_id DESC"))
{
$text .= "<table class='fborder' style='".ADMIN_WIDTH."'>
<tr>
@ -1185,7 +1181,7 @@ class newspost
<td style='width:70%' class='fcaption'>".NWSLAN_57."</td>
<td style='width:25%; text-align:center' class='fcaption'>".LAN_OPTIONS."</td>
</tr>";
while ($row = $sql2->db_Fetch())
while ($row = $sql2->db_Fetch())
{
extract($row);
if (substr($submitnews_item,-7,7) == '[/html]') $submitnews_item = substr($submitnews_item,0,-7);
@ -1206,7 +1202,7 @@ class newspost
}
$text .= "</table>";
}
else
else
{
$text .= "<div style='text-align:center'>".NWSLAN_59."</div>";
}

View File

@ -0,0 +1,24 @@
<?php
function url_news_main($parms)
{
$base = e_HTTP.'news.php?'.$parms['action'];
switch ($parms['action'])
{
case 'all':
return $base;
case 'cat':
case 'extend':
case 'list'://TODO - find out what are list params
case 'month': //TODO - find out what are month params
case 'day': //TODO - find out what are day params
return $base.'.'.$parms['value'];
case 'item':
return $base.".{$parms['id']}.{$parms['cat']}";
default:
return false;
}
}
?>

View File

@ -1,20 +1,17 @@
<?php
/*
+ ----------------------------------------------------------------------------+
| e107 website system
|
| ©Steve Dunstan 2001-2002
| http://e107.org
| jalist@e107.org
|
| Released under the terms and conditions of the
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_files/shortcode/batch/news_shortcodes.php,v $
| $Revision: 1.11 $
| $Date: 2008-12-01 21:04:12 $
| $Author: e107steved $
+----------------------------------------------------------------------------+
* e107 website system
*
* Copyright (C) 2001-2008 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
* News Shortcode Batch
*
* $Source: /cvs_backup/e107_0.8/e107_files/shortcode/batch/news_shortcodes.php,v $
* $Revision: 1.12 $
* $Date: 2008-12-02 16:50:15 $
* $Author: secretr $
*/
if (!defined('e107_INIT')) { exit; }
include_once(e_HANDLER.'shortcode_handler.php');
@ -40,12 +37,13 @@ return $news_body;
SC_END
SC_BEGIN NEWSICON
global $tp, $news_shortcodes;
global $e107, $tp, $news_shortcodes;
$news_item = getcachedvars('current_news_item');
$param = getcachedvars('current_news_param');
$category_icon = $tp -> parseTemplate('{NEWSHEADER}', FALSE, $news_shortcodes);
if (!$category_icon) return '';
return "<a href='".e_HTTP."news.php?cat.".$news_item['news_category']."'><img style='".$param['caticon']."' src='".$category_icon."' alt='' /></a>";
return "<a href='".$e107->url->getUrl('core:news', 'main', 'action=cat&value='.$news_item['news_category'])."'><img style='".$param['caticon']."' src='".$category_icon."' alt='' /></a>";
SC_END
SC_BEGIN NEWSHEADER
@ -61,14 +59,15 @@ if ($category_icon && strstr("images", $category_icon)) {
SC_END
SC_BEGIN NEWSCATEGORY
global $tp;
global $tp, $e107;
$news_item = getcachedvars('current_news_item');
$param = getcachedvars('current_news_param');
$category_name = $tp -> toHTML($news_item['category_name'],FALSE,"defs");
return "<a class='".$GLOBALS['NEWS_CSSMODE']."_category' style='".(isset($param['catlink']) ? $param['catlink'] : "#")."' href='".e_HTTP."news.php?cat.".$news_item['news_category']."'>".$category_name."</a>";
return "<a class='".$GLOBALS['NEWS_CSSMODE']."_category' style='".(isset($param['catlink']) ? $param['catlink'] : "#")."' href='".$e107->url->getUrl('core:news', 'main', 'action=cat&value='.$news_item['news_category'])."'>".$category_name."</a>";
SC_END
SC_BEGIN NEWSAUTHOR
global $e107;
$news_item = getcachedvars('current_news_item');
$param = getcachedvars('current_news_param');
if($news_item['user_id'])
@ -79,7 +78,7 @@ if($news_item['user_id'])
}
else
{
return "<a href='".e_HTTP."user.php?id.".$news_item['user_id']."'>".$news_item['user_name']."{$parm}</a>";
return "<a href='".$e107->url->getUrl('core:user', 'main', 'func=profile&id='.$news_item['user_id'])."'>".$news_item['user_name']."{$parm}</a>";
}
}
return "<a href='http://e107.org'>e107</a>";
@ -199,6 +198,7 @@ if (ADMIN && getperms("H")) {
SC_END
SC_BEGIN EXTENDED
global $e107;
$news_item = getcachedvars('current_news_item');
$param = getcachedvars('current_news_param');
if ($news_item['news_extended'] && (strpos(e_QUERY, 'extend') === FALSE || $parm == "force")) {
@ -211,7 +211,7 @@ if ($news_item['news_extended'] && (strpos(e_QUERY, 'extend') === FALSE || $parm
if (isset($_POST['preview'])) {
return $es1.EXTENDEDSTRING.$es2."<br />".$news_item['news_extended'];
} else {
return $es1."<a href='".e_HTTP."news.php?extend.".$news_item['news_id']."'>".EXTENDEDSTRING."</a>".$es2;
return $es1."<a href='".$e107->url->getUrl('core:news', 'main', 'action=extend&value='.$news_item['news_id'])."'>".EXTENDEDSTRING."</a>".$es2;
}
} else {
return "";
@ -249,15 +249,17 @@ return ($news_item['news_summary']) ? $news_item['news_summary']."<br />" : "";
SC_END
SC_BEGIN NEWSTHUMBNAIL
global $e107;
$news_item = getcachedvars('current_news_item');
$param = getcachedvars('current_news_param');
return (isset($news_item['news_thumbnail']) && $news_item['news_thumbnail']) ? "<a href='".e_HTTP."news.php?item.".$news_item['news_id'].".".$news_item['news_category']."'><img class='news_image' src='".e_IMAGE_ABS."newspost_images/".$news_item['news_thumbnail']."' alt='' style='".$param['thumbnail']."' /></a>" : "";
$param = getcachedvars('current_news_param'); echo
return (isset($news_item['news_thumbnail']) && $news_item['news_thumbnail']) ? "<a href='".$e107->url->getUrl('core:news', 'main', "action=item&id={$news_item['news_id']}&cat={$news_item['news_category']}")."'><img class='news_image' src='".e_IMAGE_ABS."newspost_images/".$news_item['news_thumbnail']."' alt='' style='".$param['thumbnail']."' /></a>" : "";
SC_END
SC_BEGIN NEWSIMAGE
global $e107;
$news_item = getcachedvars('current_news_item');
$param = getcachedvars('current_news_param');
return (isset($news_item['news_thumbnail']) && $news_item['news_thumbnail']) ? "<a href='".e_HTTP."news.php?item.".$news_item['news_id'].".".$news_item['news_category']."'><img class='news_image' src='".e_IMAGE_ABS."newspost_images/".$news_item['news_thumbnail']."' alt='' style='".$param['thumbnail']."' /></a>" : "";
return (isset($news_item['news_thumbnail']) && $news_item['news_thumbnail']) ? "<a href='".$e107->url->getUrl('core:news', 'main', "action=item&id={$news_item['news_id']}&cat={$news_item['news_category']}")."'><img class='news_image' src='".e_IMAGE_ABS."newspost_images/".$news_item['news_thumbnail']."' alt='' style='".$param['thumbnail']."' /></a>" : "";
SC_END
SC_BEGIN STICKY_ICON
@ -267,19 +269,20 @@ return $news_item['news_sticky'] ? $param['image_sticky'] : "";
SC_END
SC_BEGIN NEWSTITLELINK
global $e107;
$news_item = getcachedvars('current_news_item');
$param = getcachedvars('current_news_param');
return "<a style='".(isset($param['itemlink']) ? $param['itemlink'] : "null")."' href='".e_HTTP."news.php?item.".$news_item['news_id'].".".$news_item['news_category']."'>".$news_item['news_title']."</a>";
return "<a style='".(isset($param['itemlink']) ? $param['itemlink'] : "null")."' href='".$e107->url->getUrl('core:news', 'main', "action=item&id={$news_item['news_id']}&cat={$news_item['news_category']}")."'>".$news_item['news_title']."</a>";
SC_END
SC_BEGIN NEWSCATICON
global $tp, $news_shortcodes;
global $e107, $news_shortcodes;
$news_item = getcachedvars('current_news_item');
$param = getcachedvars('current_news_param');
$category_icon = $tp -> parseTemplate('{NEWSHEADER}', FALSE, $news_shortcodes);
$category_icon = $e107->tp->parseTemplate('{NEWSHEADER}', FALSE, $news_shortcodes);
if (!$category_icon) return '';
if($param['caticon'] == ""){$param['caticon'] = "border:0px";}
return "<a href='".e_HTTP."news.php?cat.".$news_item['news_category']."'><img style='".$param['caticon']."' src='".$category_icon."' alt='' /></a>";
return "<a href='".$e107->url->getUrl('core:news', 'main', "action=cat&value{$news_item['news_category']}")."'><img style='".$param['caticon']."' src='".$category_icon."' alt='' /></a>";
SC_END
SC_BEGIN TRACKBACK

View File

@ -1,21 +1,17 @@
<?php
/*
+---------------------------------------------------------------+
| e107 website system
| /classes/news_class.php
|
| ©Steve Dunstan 2001-2002
| http://jalist.com
| stevedunstan@jalist.com
|
| Released under the terms and conditions of the
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_handlers/news_class.php,v $
| $Revision: 1.5 $
| $Date: 2008-05-18 16:34:16 $
| $Author: e107coders $
+---------------------------------------------------------------+
* e107 website system
*
* Copyright (C) 2001-2008 e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
* News handler
*
* $Source: /cvs_backup/e107_0.8/e107_handlers/news_class.php,v $
* $Revision: 1.6 $
* $Date: 2008-12-02 16:50:15 $
* $Author: secretr $
*/
if (!defined('e107_INIT')) { exit; }
@ -108,14 +104,14 @@ class news {
}
function render_newsitem($news, $mode = 'default', $n_restrict = '', $NEWS_TEMPLATE = '', $param='') {
global $tp, $sql, $override, $pref, $ns, $NEWSSTYLE, $NEWSLISTSTYLE, $news_shortcodes, $loop_uid, $imode;
global $e107, $tp, $sql, $override, $pref, $ns, $NEWSSTYLE, $NEWSLISTSTYLE, $news_shortcodes, $loop_uid, $imode;
if ($override_newsitem = $override -> override_check('render_newsitem')) {
$result = call_user_func($override_newsitem, $news, $mode, $n_restrict, $NEWS_TEMPLATE, $param);
if ($result == 'return') {
return;
}
}
if (!is_object($tp)) $tp = new e_parse;
if (!is_object($e107->tp)) $e107->tp = new e_parse;
if ($n_restrict == 'userclass') {
$news['news_id'] = 0;
@ -129,7 +125,7 @@ class news {
$news['comment_total'] = 0;
}
if (!$param)
if (!$param)
{
$param['caticon'] = ICONSTYLE;
$param['commentoffstring'] = COMMENTOFFSTRING;
@ -152,10 +148,10 @@ class news {
}
$param['image_nonew_small'] = IMAGE_nonew_small;
}
if (!isset($param['image_new_small']))
{
if (!defined("IMAGE_new_small"))
if (!defined("IMAGE_new_small"))
{
define("IMAGE_new_small", (file_exists(THEME."images/new_comments.png") ? "<img src='".THEME_ABS."images/new_comments.png' alt='' /> " : "<img src='".e_IMAGE_ABS."packs/".$imode."/generic/new_comments.png' alt='' /> "));
}
@ -196,7 +192,7 @@ class news {
$loop_uid = $news['news_author'];
require_once(e_FILE.'shortcode/batch/news_shortcodes.php');
$text = $tp -> parseTemplate($NEWS_PARSE, TRUE, $news_shortcodes);
$text = $e107->tp -> parseTemplate($NEWS_PARSE, TRUE, $news_shortcodes);
if ($mode == 'return') {
return $text;
@ -207,12 +203,12 @@ class news {
}
function make_xml_compatible($original) {
global $tp, $ml;
if (!is_object($tp)) $tp = new e_parse;
$original = $tp->toHTML($original, TRUE);
global $e107;
if (!is_object($e107->tp)) $e107->tp = new e_parse;
$original = $e107->tp->toHTML($original, TRUE);
$original = str_replace('&pound', '&amp;#163;', $original);
$original = str_replace('&copy;', '(c)', $original);
return htmlspecialchars($original);
return htmlspecialchars($original, ENT_COMPAT, CHARSET);
}
}