1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-01 20:30:39 +02:00

Bugtracker #4507 - make shortcodes use ICONPRINT, ICONMAIL, plus some absolute path stuff

This commit is contained in:
e107steved
2008-09-04 20:07:34 +00:00
parent 276cf7e01c
commit a77df1a354
5 changed files with 65 additions and 49 deletions

View File

@@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_files/shortcode/batch/news_shortcodes.php,v $
| $Revision: 1.8 $
| $Date: 2008-07-25 19:26:46 $
| $Revision: 1.9 $
| $Date: 2008-09-04 20:07:19 $
| $Author: e107steved $
+----------------------------------------------------------------------------+
*/
@@ -45,7 +45,7 @@ $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_BASE."news.php?cat.".$news_item['news_category']."'><img style='".$param['caticon']."' src='".$category_icon."' alt='' /></a>";
return "<a href='".e_HTTP."news.php?cat.".$news_item['news_category']."'><img style='".$param['caticon']."' src='".$category_icon."' alt='' /></a>";
SC_END
SC_BEGIN NEWSHEADER
@@ -54,9 +54,9 @@ $param = getcachedvars('current_news_param');
$category_icon = str_replace("../", "", trim($news_item['category_icon']));
if (!$category_icon) return '';
if ($category_icon && strstr("images", $category_icon)) {
return THEME.$category_icon;
return THEME_ABS.$category_icon;
} else {
return e_IMAGE."icons/".$category_icon;
return e_IMAGE_ABS."icons/".$category_icon;
}
SC_END
@@ -65,7 +65,7 @@ global $tp;
$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_BASE."news.php?cat.".$news_item['news_category']."'>".$category_name."</a>";
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>";
SC_END
SC_BEGIN NEWSAUTHOR
@@ -79,7 +79,7 @@ if($news_item['user_id'])
}
else
{
return "<a href='".e_BASE."user.php?id.".$news_item['user_id']."'>".$news_item['user_name']."{$parm}</a>";
return "<a href='".e_HTTP."user.php?id.".$news_item['user_id']."'>".$news_item['user_name']."{$parm}</a>";
}
}
return "<a href='http://e107.org'>e107</a>";
@@ -131,14 +131,14 @@ if ($news_item['news_comment_total']) {
} else {
$NEWIMAGE = $param['image_nonew_small'];
}
return ($news_item['news_allow_comments'] ? $param['commentoffstring'] : "".($pref['comments_icon'] ? $NEWIMAGE : "")." <a href='".e_BASE."comment.php?comment.news.".$news_item['news_id']."'>".$param['commentlink'].$news_item['news_comment_total']."</a>");
return ($news_item['news_allow_comments'] ? $param['commentoffstring'] : "".($pref['comments_icon'] ? $NEWIMAGE : "")." <a href='".e_HTTP."comment.php?comment.news.".$news_item['news_id']."'>".$param['commentlink'].$news_item['news_comment_total']."</a>");
SC_END
SC_BEGIN NEWSCOMMENTLINK
global $pref, $sql;
$news_item = getcachedvars('current_news_item');
$param = getcachedvars('current_news_param');
return ($news_item['news_allow_comments'] ? $param['commentoffstring'] : " <a href='".e_BASE."comment.php?comment.news.".$news_item['news_id']."'>".$param['commentlink']."</a>");
return ($news_item['news_allow_comments'] ? $param['commentoffstring'] : " <a href='".e_HTTP."comment.php?comment.news.".$news_item['news_id']."'>".$param['commentlink']."</a>");
SC_END
SC_BEGIN NEWSCOMMENTCOUNT
@@ -180,8 +180,8 @@ global $imode;
$news_item = getcachedvars('current_news_item');
$param = getcachedvars('current_news_param');
if (ADMIN && getperms("H")) {
$adop_icon = (file_exists(THEME."images/newsedit.png") ? THEME."images/newsedit.png" : e_IMAGE."packs/".$imode."/generic/newsedit.png");
return " <a href='".e_BASE.e_ADMIN."newspost.php?create.edit.".$news_item['news_id']."'><img src='".$adop_icon."' alt='' style='border:0' /></a>\n";
$adop_icon = (file_exists(THEME."images/newsedit.png") ? THEME_ABS."images/newsedit.png" : e_IMAGE_ABS."packs/".$imode."/generic/newsedit.png");
return " <a href='".e_ADMIN_ABS."newspost.php?create.edit.".$news_item['news_id']."'><img src='".$adop_icon."' alt='' style='border:0' /></a>\n";
} else {
return '';
}
@@ -200,7 +200,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_BASE."news.php?extend.".$news_item['news_id']."'>".EXTENDEDSTRING."</a>".$es2;
return $es1."<a href='".e_HTTP."news.php?extend.".$news_item['news_id']."'>".EXTENDEDSTRING."</a>".$es2;
}
} else {
return "";
@@ -212,7 +212,7 @@ global $tp;
$news_item = getcachedvars('current_news_item');
$param = getcachedvars('current_news_param');
$news_title = $tp -> toHTML($news_item['news_title'], TRUE,'no_hook,emotes_off, no_make_clickable');
return "<div class='category".$news_item['news_category']."'>".($news_item['news_render_type'] == 1 ? "<a href='".e_BASE."comment.php?comment.news.".$news_item['news_id']."'>".$news_title."</a>" : $news_title)."</div>";
return "<div class='category".$news_item['news_category']."'>".($news_item['news_render_type'] == 1 ? "<a href='".e_HTTP."comment.php?comment.news.".$news_item['news_id']."'>".$news_title."</a>" : $news_title)."</div>";
SC_END
SC_BEGIN ADMINCAPTION
@@ -220,7 +220,7 @@ global $tp;
$news_item = getcachedvars('current_news_item');
$param = getcachedvars('current_news_param');
$news_title = $tp -> toHTML($news_item['news_title'], TRUE,'no_hook,emotes_off, no_make_clickable');
return "<div class='".(defined(ADMINNAME) ? ADMINNAME : "null")."'>".($news_item['news_render_type'] == 1 ? "<a href='".e_BASE."comment.php?comment.news.".$news_item['news_id']."'>".$news_title."</a>" : $news_title)."</div>";
return "<div class='".(defined(ADMINNAME) ? ADMINNAME : "null")."'>".($news_item['news_render_type'] == 1 ? "<a href='".e_HTTP."comment.php?comment.news.".$news_item['news_id']."'>".$news_title."</a>" : $news_title)."</div>";
SC_END
SC_BEGIN ADMINBODY
@@ -240,13 +240,13 @@ SC_END
SC_BEGIN NEWSTHUMBNAIL
$news_item = getcachedvars('current_news_item');
$param = getcachedvars('current_news_param');
return (isset($news_item['news_thumbnail']) && $news_item['news_thumbnail']) ? "<a href='".e_BASE."news.php?item.".$news_item['news_id'].".".$news_item['news_category']."'><img class='news_image' src='".e_IMAGE."newspost_images/".$news_item['news_thumbnail']."' alt='' style='".$param['thumbnail']."' /></a>" : "";
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>" : "";
SC_END
SC_BEGIN NEWSIMAGE
$news_item = getcachedvars('current_news_item');
$param = getcachedvars('current_news_param');
return (isset($news_item['news_thumbnail']) && $news_item['news_thumbnail']) ? "<a href='".e_BASE."news.php?item.".$news_item['news_id'].".".$news_item['news_category']."'><img class='news_image' src='".e_IMAGE."newspost_images/".$news_item['news_thumbnail']."' alt='' style='".$param['thumbnail']."' /></a>" : "";
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>" : "";
SC_END
SC_BEGIN STICKY_ICON
@@ -258,7 +258,7 @@ SC_END
SC_BEGIN NEWSTITLELINK
$news_item = getcachedvars('current_news_item');
$param = getcachedvars('current_news_param');
return "<a style='".(isset($param['itemlink']) ? $param['itemlink'] : "null")."' href='".e_BASE."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='".e_HTTP."news.php?item.".$news_item['news_id'].".".$news_item['news_category']."'>".$news_item['news_title']."</a>";
SC_END
SC_BEGIN NEWSCATICON
@@ -268,7 +268,7 @@ $param = getcachedvars('current_news_param');
$category_icon = $tp -> parseTemplate('{NEWSHEADER}', FALSE, $news_shortcodes);
if (!$category_icon) return '';
if($param['caticon'] == ""){$param['caticon'] = "border:0px";}
return "<a href='".e_BASE."news.php?cat.".$news_item['news_category']."'><img style='".$param['caticon']."' src='".$category_icon."' alt='' /></a>";
return "<a href='".e_HTTP."news.php?cat.".$news_item['news_category']."'><img style='".$param['caticon']."' src='".$category_icon."' alt='' /></a>";
SC_END
SC_BEGIN TRACKBACK
@@ -276,7 +276,7 @@ global $pref;
if(!varsettrue($pref['trackbackEnabled'])) return '';
$news_item = getcachedvars('current_news_item');
$param = getcachedvars('current_news_param');
return ($param['trackbackbeforestring'] ? $param['trackbackbeforestring'] : "")."<a href='".e_BASE."comment.php?comment.news.".$news_item['news_id']."#track'>".$param['trackbackstring'].$news_item['tb_count']."</a>".($param['trackbackafterstring'] ? $param['trackbackafterstring'] : "");
return ($param['trackbackbeforestring'] ? $param['trackbackbeforestring'] : "")."<a href='".e_HTTP."comment.php?comment.news.".$news_item['news_id']."#track'>".$param['trackbackstring'].$news_item['tb_count']."</a>".($param['trackbackafterstring'] ? $param['trackbackafterstring'] : "");
SC_END
SC_BEGIN NEWSINFO

View File

@@ -2,12 +2,12 @@ global $imode;
if (defined("ICONMAIL") && file_exists(THEME."images/".ICONMAIL))
{
$icon = THEME."images/".ICONMAIL;
$icon = THEME_ABS."images/".ICONMAIL;
}
else
{
$icon = e_IMAGE."packs/".$imode."/generic/email.png";
$icon = e_IMAGE_ABS."packs/".$imode."/generic/email.png";
}
$parms = explode("^",$parm);
// message^source^other_parms
return "<a href='".e_BASE."email.php?{$parms[1]}'><img src='".$icon."' style='border:0' alt='{$parms[0]}' title='{$parms[0]}'/></a>";
return "<a href='".e_HTTP."email.php?{$parms[1]}'><img src='".$icon."' style='border:0' alt='{$parms[0]}' title='{$parms[0]}'/></a>";

View File

@@ -2,11 +2,11 @@ global $imode;
if (defined("ICONPRINT") && file_exists(THEME."images/".ICONPRINT))
{
$icon = THEME."images/".ICONPRINT;
$icon = THEME_ABS."images/".ICONPRINT;
}
else
{
$icon = e_IMAGE."packs/".$imode."/generic/printer.png";
$icon = e_IMAGE_ABS."packs/".$imode."/generic/printer.png";
}
$parms = explode("^",$parm);
return "<a href='".e_BASE."print.php?{$parms[1]}'><img src='".$icon."' style='border:0' alt='{$parms[0]}' title='{$parms[0]}' /></a>";
return "<a href='".e_HTTP."print.php?{$parms[1]}'><img src='".$icon."' style='border:0' alt='{$parms[0]}' title='{$parms[0]}' /></a>";

View File

@@ -11,21 +11,23 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_handlers/emailprint_class.php,v $
| $Revision: 1.2 $
| $Date: 2006-12-07 15:41:50 $
| $Author: sweetas $
| $Revision: 1.3 $
| $Date: 2008-09-04 20:07:27 $
| $Author: e107steved $
+----------------------------------------------------------------------------+
*/
if (!defined('e107_INIT')) { exit; }
@include_once(e_LANGUAGEDIR.e_LANGUAGE."/lan_print.php");
@include_once(e_LANGUAGEDIR."English/lan_print.php");
@include_once(e_LANGUAGEDIR.e_LANGUAGE."/lan_email.php");
@include_once(e_LANGUAGEDIR."English/lan_email.php");
@include_lan(e_LANGUAGEDIR.e_LANGUAGE."/lan_print.php");
//@include_once(e_LANGUAGEDIR."English/lan_print.php");
@include_lan(e_LANGUAGEDIR.e_LANGUAGE."/lan_email.php");
//@include_once(e_LANGUAGEDIR."English/lan_email.php");
class emailprint {
function render_emailprint($mode, $id, $look = 0) {
class emailprint
{
function render_emailprint($mode, $id, $look = 0)
{
// $look = 0 --->display all icons
// $look = 1 --->display email icon only
// $look = 2 --->display print icon only
@@ -35,17 +37,24 @@ class emailprint {
$text_emailprint = "";
//new method emailprint_class : (only news is core, rest is plugin: searched for e_emailprint.php which should hold $email and $print values)
if($mode == "news"){
if($mode == "news")
{
$email = "news";
$print = "news";
}else{
}
else
{
//load the others from plugins
$handle = opendir(e_PLUGIN);
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != ".." && is_dir(e_PLUGIN.$file)) {
while (false !== ($file = readdir($handle)))
{
if ($file != "." && $file != ".." && is_dir(e_PLUGIN.$file))
{
$plugin_handle = opendir(e_PLUGIN.$file."/");
while (false !== ($file2 = readdir($plugin_handle))) {
if ($file2 == "e_emailprint.php") {
while (false !== ($file2 = readdir($plugin_handle)))
{
if ($file2 == "e_emailprint.php")
{
require_once(e_PLUGIN.$file."/".$file2);
}
}
@@ -53,13 +62,15 @@ class emailprint {
}
}
if ($look == 0 || $look == 1) {
$ico_mail = (file_exists(THEME."images/email.png") ? THEME."images/email.png" : e_IMAGE."packs/".$imode."/generic/email.png");
$text_emailprint .= "<a href='".e_BASE."email.php?".$email.".".$id."'><img src='".$ico_mail."' style='border:0' alt='".LAN_EMAIL_7."' title='".LAN_EMAIL_7."' /></a> ";
if ($look == 0 || $look == 1)
{
$ico_mail = (file_exists(THEME."images/".ICONMAIL) ? THEME_ABS."images/".ICONMAIL : e_IMAGE_ABS."packs/".$imode."/generic/email.png");
$text_emailprint .= "<a href='".e_HTTP."email.php?".$email.".".$id."'><img src='".$ico_mail."' style='border:0' alt='".LAN_EMAIL_7."' title='".LAN_EMAIL_7."' /></a> ";
}
if ($look == 0 || $look == 2) {
$ico_print = (file_exists(THEME."images/printer.png") ? THEME."images/printer.png" : e_IMAGE."packs/".$imode."/generic/printer.png");
$text_emailprint .= "<a href='".e_BASE."print.php?".$print.".".$id."'><img src='".$ico_print."' style='border:0' alt='".LAN_PRINT_1."' title='".LAN_PRINT_1."' /></a>";
if ($look == 0 || $look == 2)
{
$ico_print = (file_exists(THEME."images/".ICONPRINT) ? THEME_ABS."images/".ICONPRINT : e_IMAGE_ABS."packs/".$imode."/generic/printer.png");
$text_emailprint .= "<a href='".e_HTTP."print.php?".$print.".".$id."'><img src='".$ico_print."' style='border:0' alt='".LAN_PRINT_1."' title='".LAN_PRINT_1."' /></a>";
}
return $text_emailprint;
}

View File

@@ -1,14 +1,19 @@
/*
* e107 website system (c) 2001-2008 Steve Dunstan (e107.org)
* $Id: pdf.sc,v 1.2 2008-09-04 20:07:34 e107steved Exp $
*/
if (defined("ICONPRINTPDF") && file_exists(THEME."images/".ICONPRINTPDF))
{
$icon = THEME."images/".ICONPRINTPDF;
$icon = THEME_ABS."images/".ICONPRINTPDF;
}
else
{
$icon = e_PLUGIN."pdf/images/pdf_16.png";
$icon = e_PLUGIN_ABS."pdf/images/pdf_16.png";
}
$parms = explode("^",$parm);
//core //return "<a href='".e_BASE."pdf.php?{$parms[1]}'><img src='".$icon."' style='border:0' alt='{$parms[0]}' title='{$parms[0]}' /></a>";
//plugin //return "<a href='".e_PLUGIN."pdf/pdf.php?{$parms[1]}'><img src='".$icon."' style='border:0' alt='{$parms[0]}' title='{$parms[0]}' /></a>";
return " <a href='".e_PLUGIN."pdf/pdf.php?{$parms[1]}'><img src='".$icon."' style='border:0' alt='{$parms[0]}' title='{$parms[0]}' /></a>";
return " <a href='".e_PLUGIN_ABS."pdf/pdf.php?{$parms[1]}'><img src='".$icon."' style='border:0' alt='{$parms[0]}' title='{$parms[0]}' /></a>";