mirror of
https://github.com/e107inc/e107.git
synced 2025-08-01 12:20:44 +02:00
Fixes #1597 - Legacy shortcode issue.
This commit is contained in:
@@ -1,523 +0,0 @@
|
|||||||
<?php
|
|
||||||
/*
|
|
||||||
* e107 website system
|
|
||||||
*
|
|
||||||
* Copyright (C) 2008-2009 e107 Inc (e107.org)
|
|
||||||
* Released under the terms and conditions of the
|
|
||||||
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* $Source: /cvs_backup/e107_0.8/e107_files/shortcode/batch/download_shortcodes.php,v $
|
|
||||||
* $Revision$
|
|
||||||
* $Date$
|
|
||||||
* $Author$
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (!defined('e107_INIT')) { exit; }
|
|
||||||
include_once(e_HANDLER.'shortcode_handler.php');
|
|
||||||
$download_shortcodes = $tp -> e_sc -> parse_scbatch(__FILE__);
|
|
||||||
/*
|
|
||||||
SC_BEGIN DOWNLOAD_LIST_NAME
|
|
||||||
global $row,$tp,$pref;
|
|
||||||
if($parm == "nolink"){
|
|
||||||
return $tp->toHTML($row['download_name'],TRUE,'LINKTEXT');
|
|
||||||
}
|
|
||||||
if($parm == "request"){
|
|
||||||
|
|
||||||
$agreetext = $tp->toJS($tp->toHTML($pref['agree_text'],FALSE,'DESCRIPTION'));
|
|
||||||
if($row['download_mirror_type']){
|
|
||||||
$text = ($pref['agree_flag'] ? "<a href='".e_BASE."download.php?mirror.".$row['download_id']."' onclick= \"return confirm('{$agreetext}');\">" : "<a href='".e_BASE."download.php?mirror.".$row['download_id']."' title='".LAN_DOWNLOAD."'>");
|
|
||||||
}else{
|
|
||||||
$text = ($pref['agree_flag'] ? "<a href='".e_BASE."request.php?".$row['download_id']."' onclick= \"return confirm('{$agreetext}');\">" : "<a href='".e_BASE."request.php?".$row['download_id']."' title='".LAN_DOWNLOAD."'>");
|
|
||||||
}
|
|
||||||
$text .= $tp->toHTML($row['download_name'], FALSE, 'USER_TITLE')."</a>";
|
|
||||||
return $text;
|
|
||||||
}
|
|
||||||
|
|
||||||
return "<a href='".e_BASE."download.php?view.".$row['download_id']."'>".$tp->toHTML($row['download_name'],TRUE,'LINKTEXT')."</a>";
|
|
||||||
SC_END
|
|
||||||
|
|
||||||
|
|
||||||
SC_BEGIN DOWNLOAD_LIST_AUTHOR
|
|
||||||
global $row;
|
|
||||||
return $row['download_author'];
|
|
||||||
SC_END
|
|
||||||
|
|
||||||
|
|
||||||
SC_BEGIN DOWNLOAD_LIST_REQUESTED
|
|
||||||
global $row;
|
|
||||||
return $row['download_requested'];
|
|
||||||
SC_END
|
|
||||||
|
|
||||||
|
|
||||||
SC_BEGIN DOWNLOAD_LIST_ICON
|
|
||||||
global $row;
|
|
||||||
$img = "<img src='".IMAGE_DOWNLOAD."' alt='' style='border:0' title='".LAN_DOWNLOAD."' />";
|
|
||||||
if($parm == "link"){
|
|
||||||
return "<a href='".e_BASE."download.php?view.".$row['download_id']."' >".$img."</a>";
|
|
||||||
}else{
|
|
||||||
return $img;
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
SC_END
|
|
||||||
|
|
||||||
|
|
||||||
SC_BEGIN DOWNLOAD_LIST_NEWICON
|
|
||||||
global $row;
|
|
||||||
return (USER && $row['download_datestamp'] > USERLV ? "<img src='".IMAGE_NEW."' alt='' style='vertical-align:middle' />" : "");
|
|
||||||
SC_END
|
|
||||||
|
|
||||||
|
|
||||||
SC_BEGIN DOWNLOAD_LIST_FILESIZE
|
|
||||||
global $row, $e107;
|
|
||||||
return $e107->parseMemorySize($row['download_filesize']);
|
|
||||||
SC_END
|
|
||||||
|
|
||||||
|
|
||||||
SC_BEGIN DOWNLOAD_LIST_DATESTAMP
|
|
||||||
global $row;
|
|
||||||
$gen = new convert;
|
|
||||||
return $gen->convert_date($row['download_datestamp'], "short");
|
|
||||||
SC_END
|
|
||||||
|
|
||||||
|
|
||||||
SC_BEGIN DOWNLOAD_LIST_THUMB
|
|
||||||
global $row;
|
|
||||||
$img = ($row['download_thumb']) ? "<img src='".e_FILE."downloadthumbs/".$row['download_thumb']."' alt='' style='".DL_IMAGESTYLE."' />" : "";
|
|
||||||
if($parm == "link" && $row['download_thumb']){
|
|
||||||
return "<a href='".e_BASE."download.php?view.".$row['download_id']."'>".$img."</a>";
|
|
||||||
}else{
|
|
||||||
return $img;
|
|
||||||
}
|
|
||||||
SC_END
|
|
||||||
|
|
||||||
|
|
||||||
SC_BEGIN DOWNLOAD_LIST_ID
|
|
||||||
global $row;
|
|
||||||
return $row['download_id'];
|
|
||||||
SC_END
|
|
||||||
|
|
||||||
|
|
||||||
SC_BEGIN DOWNLOAD_LIST_RATING
|
|
||||||
global $row;
|
|
||||||
$rater = new rater;
|
|
||||||
$ratearray = $rater->getrating("download", $row['download_id']);
|
|
||||||
if (!$ratearray[0]) {
|
|
||||||
return LAN_dl_13;
|
|
||||||
} else {
|
|
||||||
return ($ratearray[2] ? "{$ratearray[1]}.{$ratearray[2]}/{$ratearray[0]}" : "{$ratearray[1]}/{$ratearray[0]}");
|
|
||||||
}
|
|
||||||
SC_END
|
|
||||||
|
|
||||||
|
|
||||||
SC_BEGIN DOWNLOAD_LIST_LINK
|
|
||||||
global $tp,$row,$pref;
|
|
||||||
$agreetext = $tp->toJS($tp->toHTML($pref['agree_text'],FALSE,'DESCRIPTION'));
|
|
||||||
if($row['download_mirror_type']){
|
|
||||||
return ($pref['agree_flag'] ? "<a href='".e_BASE."download.php?mirror.".$row['download_id']."' onclick= \"return confirm('{$agreetext}');\">" : "<a href='".e_BASE."download.php?mirror.".$row['download_id']."' >");
|
|
||||||
}else{
|
|
||||||
return ($pref['agree_flag'] ? "<a href='".e_BASE."request.php?".$row['download_id']."' onclick= \"return confirm('{$agreetext}');\">" : "<a href='".e_BASE."request.php?".$row['download_id']."' >");
|
|
||||||
}
|
|
||||||
SC_END
|
|
||||||
|
|
||||||
SC_BEGIN DOWNLOAD_LIST_NEXTPREV
|
|
||||||
global $nextprev_parms,$tp;
|
|
||||||
return $tp->parseTemplate("{NEXTPREV={$nextprev_parms}}");
|
|
||||||
SC_END
|
|
||||||
|
|
||||||
|
|
||||||
// ---------------------- Download View ----------------------------------------
|
|
||||||
|
|
||||||
SC_BEGIN DOWNLOAD_VIEW_ID
|
|
||||||
global $dl;
|
|
||||||
return $dl['download_id'];
|
|
||||||
SC_END
|
|
||||||
|
|
||||||
|
|
||||||
SC_BEGIN DOWNLOAD_ADMIN_EDIT
|
|
||||||
global $dl;
|
|
||||||
return (ADMIN && getperms('6')) ? "<a href='".e_ADMIN."download.php?create.edit.".$dl['download_id']."' title='edit'><img src='".e_IMAGE."generic/lite/edit.png' alt='' style='padding:0px;border:0px' /></a>" : "";
|
|
||||||
SC_END
|
|
||||||
|
|
||||||
SC_BEGIN DOWNLOAD_CATEGORY
|
|
||||||
global $dl;
|
|
||||||
return $dl['download_category_name'];
|
|
||||||
SC_END
|
|
||||||
|
|
||||||
SC_BEGIN DOWNLOAD_CATEGORY_ICON
|
|
||||||
global $dl;
|
|
||||||
list($present,$missing) = explode(chr(1),$dl['download_category_icon']);
|
|
||||||
if($present)
|
|
||||||
{
|
|
||||||
return "<img class='dl_cat_icon' src='".e_IMAGE."icons/".$present."' alt='' />";
|
|
||||||
}
|
|
||||||
|
|
||||||
SC_END
|
|
||||||
|
|
||||||
SC_BEGIN DOWNLOAD_CATEGORY_DESCRIPTION
|
|
||||||
global $tp,$dl;
|
|
||||||
$text = $tp -> toHTML($dl['download_category_description'], TRUE,'DESCRIPTION');
|
|
||||||
if($parm){
|
|
||||||
return substr($text,0,$parm);
|
|
||||||
}else{
|
|
||||||
return $text;
|
|
||||||
}
|
|
||||||
SC_END
|
|
||||||
|
|
||||||
SC_BEGIN DOWNLOAD_VIEW_NAME
|
|
||||||
global $dl;
|
|
||||||
$link['view'] = "<a href='".e_BASE."download.php?view.".$dl['download_id']."'>".$dl['download_name']."</a>";
|
|
||||||
$link['request'] = "<a href='".e_BASE."request.php?".$dl['download_id']."' title='".LAN_dl_46."'>".$dl['download_name']."</a>";
|
|
||||||
|
|
||||||
if($parm){
|
|
||||||
return $link[$parm];
|
|
||||||
}
|
|
||||||
return $dl['download_name'];
|
|
||||||
SC_END
|
|
||||||
|
|
||||||
SC_BEGIN DOWNLOAD_VIEW_NAME_LINKED
|
|
||||||
global $pref,$dl,$tp;
|
|
||||||
if ($pref['agree_flag'] == 1) {
|
|
||||||
return "<a href='".e_BASE."request.php?".$dl['download_id']."' onclick= \"return confirm('".$tp->toJS($tp->toHTML($pref['agree_text'],FALSE,'DESCRIPTION'))."');\" title='".LAN_dl_46."'>".$dl['download_name']."</a>";
|
|
||||||
} else {
|
|
||||||
return "<a href='".e_BASE."request.php?".$dl['download_id']."' title='".LAN_dl_46."'>".$dl['download_name']."</a>";
|
|
||||||
}
|
|
||||||
SC_END
|
|
||||||
|
|
||||||
SC_BEGIN DOWNLOAD_VIEW_AUTHOR
|
|
||||||
global $dl;
|
|
||||||
return ($dl['download_author'] ? $dl['download_author'] : "");
|
|
||||||
SC_END
|
|
||||||
|
|
||||||
|
|
||||||
SC_BEGIN DOWNLOAD_VIEW_AUTHOREMAIL
|
|
||||||
global $tp,$dl;
|
|
||||||
return ($dl['download_author_email']) ? $tp -> toHTML($dl['download_author_email'], TRUE, 'LINKTEXT') : "";
|
|
||||||
SC_END
|
|
||||||
|
|
||||||
SC_BEGIN DOWNLOAD_VIEW_AUTHORWEBSITE
|
|
||||||
global $tp,$dl;
|
|
||||||
return ($dl['download_author_website']) ? $tp -> toHTML($dl['download_author_website'], TRUE,'LINKTEXT') : "";
|
|
||||||
SC_END
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
SC_BEGIN DOWNLOAD_VIEW_DESCRIPTION
|
|
||||||
global $tp, $dl;
|
|
||||||
$maxlen = ($parm ? intval($parm) : 0);
|
|
||||||
$text = ($dl['download_description'] ? $tp->toHTML($dl['download_description'], TRUE, 'DESCRIPTION') : "");
|
|
||||||
if($maxlen){
|
|
||||||
return substr($text, 0, $maxlen);
|
|
||||||
}else{
|
|
||||||
return $text;
|
|
||||||
}
|
|
||||||
return $text;
|
|
||||||
SC_END
|
|
||||||
|
|
||||||
SC_BEGIN DOWNLOAD_VIEW_DATE
|
|
||||||
global $gen,$dl;
|
|
||||||
return ($dl['download_datestamp']) ? $gen->convert_date($dl['download_datestamp'], $parm) : "";
|
|
||||||
SC_END
|
|
||||||
|
|
||||||
SC_BEGIN DOWNLOAD_VIEW_DATE_SHORT
|
|
||||||
// deprecated: DOWNLOAD_VIEW_DATE should be used instead.
|
|
||||||
global $gen,$dl;
|
|
||||||
return ($dl['download_datestamp']) ? $gen->convert_date($dl['download_datestamp'], "short") : "";
|
|
||||||
SC_END
|
|
||||||
|
|
||||||
SC_BEGIN DOWNLOAD_VIEW_DATE_LONG
|
|
||||||
// deprecated: DOWNLOAD_VIEW_DATE should be used instead.
|
|
||||||
global $gen,$dl;
|
|
||||||
return ($dl['download_datestamp']) ? $gen->convert_date($dl['download_datestamp'], "long") : "";
|
|
||||||
SC_END
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
SC_BEGIN DOWNLOAD_VIEW_IMAGE
|
|
||||||
global $dl;
|
|
||||||
if ($dl['download_thumb']) {
|
|
||||||
return ($dl['download_image'] ? "<a href='".e_BASE."request.php?download.".$dl['download_id']."'><img class='dl_image' src='".e_FILE."downloadthumbs/".$dl['download_thumb']."' alt='' style='".DL_IMAGESTYLE."' /></a>" : "<img class='dl_image' src='".e_FILE."downloadthumbs/".$dl['download_thumb']."' alt='' style='".DL_IMAGESTYLE."' />");
|
|
||||||
}
|
|
||||||
else if($dl['download_image']) {
|
|
||||||
return "<a href='".e_BASE."request.php?download.".$dl['download_id']."'>".LAN_dl_40."</a>";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return LAN_dl_75;
|
|
||||||
}
|
|
||||||
SC_END
|
|
||||||
|
|
||||||
SC_BEGIN DOWNLOAD_VIEW_IMAGEFULL
|
|
||||||
global $dl;
|
|
||||||
return ($dl['download_image']) ? "<img class='dl_image' src='".e_FILE."downloadimages/".$dl['download_image']."' alt='' style='".DL_IMAGESTYLE."' />" : "";
|
|
||||||
SC_END
|
|
||||||
|
|
||||||
SC_BEGIN DOWNLOAD_VIEW_LINK
|
|
||||||
global $pref,$dl,$tp;
|
|
||||||
if ($pref['agree_flag'] == 1) {
|
|
||||||
$dnld_link = "<a href='".e_BASE."request.php?".$dl['download_id']."' onclick= \"return confirm('".$tp->toJS($tp->toHTML($pref['agree_text'],FALSE,'DESCRIPTION'))."');\">";
|
|
||||||
} else {
|
|
||||||
$dnld_link = "<a href='".e_BASE."request.php?".$dl['download_id']."'>";
|
|
||||||
}
|
|
||||||
|
|
||||||
if($dl['download_mirror'])
|
|
||||||
{
|
|
||||||
if($dl['download_mirror_type'])
|
|
||||||
{
|
|
||||||
return "<a href='".e_BASE."download.php?mirror.".$dl['download_id']."'>".LAN_dl_66."</a>";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return $dnld_link." <img src='".IMAGE_DOWNLOAD."' alt='' style='border:0' /></a>";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return $dnld_link." <img src='".IMAGE_DOWNLOAD."' alt='' style='border:0' /></a>";
|
|
||||||
}
|
|
||||||
SC_END
|
|
||||||
|
|
||||||
SC_BEGIN DOWNLOAD_VIEW_FILESIZE
|
|
||||||
global $dl, $e107;
|
|
||||||
return ($dl['download_filesize']) ? $e107->parseMemorySize($dl['download_filesize']) : "";
|
|
||||||
SC_END
|
|
||||||
|
|
||||||
SC_BEGIN DOWNLOAD_VIEW_RATING
|
|
||||||
require_once(e_HANDLER."rate_class.php");
|
|
||||||
$rater = new rater;
|
|
||||||
global $dl;
|
|
||||||
$text = "
|
|
||||||
<table style='width:100%'>
|
|
||||||
<tr>
|
|
||||||
<td style='width:50%'>";
|
|
||||||
|
|
||||||
if ($ratearray = $rater->getrating("download", $dl['download_id'])) {
|
|
||||||
for($c = 1; $c <= $ratearray[1]; $c++) {
|
|
||||||
$text .= "<img src='".e_IMAGE."rate/star.png' alt='' />";
|
|
||||||
}
|
|
||||||
if ($ratearray[2]) {
|
|
||||||
$text .= "<img src='".e_IMAGE."rate/".$ratearray[2].".png' alt='' />";
|
|
||||||
}
|
|
||||||
if ($ratearray[2] == "") {
|
|
||||||
$ratearray[2] = 0;
|
|
||||||
}
|
|
||||||
$text .= " ".$ratearray[1].".".$ratearray[2]." - ".$ratearray[0]." ";
|
|
||||||
$text .= ($ratearray[0] == 1 ? LAN_dl_43 : LAN_dl_44);
|
|
||||||
} else {
|
|
||||||
$text .= LAN_dl_13;
|
|
||||||
}
|
|
||||||
$text .= "</td><td style='width:50%; text-align:right'>";
|
|
||||||
|
|
||||||
if (!$rater->checkrated("download", $dl['download_id']) && USER) {
|
|
||||||
$text .= $rater->rateselect(" <b>".LAN_dl_14, "download", $dl['download_id'])."</b>";
|
|
||||||
}
|
|
||||||
else if(!USER) {
|
|
||||||
$text .= " ";
|
|
||||||
} else {
|
|
||||||
$text .= LAN_THANK_YOU;
|
|
||||||
}
|
|
||||||
$text .= "</td></tr></table>";
|
|
||||||
return $text;
|
|
||||||
SC_END
|
|
||||||
|
|
||||||
SC_BEGIN DOWNLOAD_REPORT_LINK
|
|
||||||
global $dl,$pref;
|
|
||||||
return (check_class($pref['download_reportbroken'])) ? "<a href='".e_BASE."download.php?report.".$dl['download_id']."'>".LAN_dl_45."</a>" : "";
|
|
||||||
SC_END
|
|
||||||
|
|
||||||
SC_BEGIN DOWNLOAD_VIEW_CAPTION
|
|
||||||
global $dl;
|
|
||||||
$text = $dl['download_category_name'];
|
|
||||||
$text .= ($dl['download_category_description']) ? " [ ".$dl['download_category_description']." ]" : "";
|
|
||||||
return $text;
|
|
||||||
SC_END
|
|
||||||
|
|
||||||
|
|
||||||
// --------- Download View Lans -----------------------------
|
|
||||||
|
|
||||||
SC_BEGIN DOWNLOAD_VIEW_AUTHOR_LAN
|
|
||||||
global $dl;
|
|
||||||
return ($dl['download_author']) ? LAN_AUTHOR : "";
|
|
||||||
SC_END
|
|
||||||
|
|
||||||
SC_BEGIN DOWNLOAD_VIEW_AUTHOREMAIL_LAN
|
|
||||||
global $dl;
|
|
||||||
return ($dl['download_author_email']) ? LAN_dl_30 : "";
|
|
||||||
SC_END
|
|
||||||
|
|
||||||
SC_BEGIN DOWNLOAD_VIEW_AUTHORWEBSITE_LAN
|
|
||||||
global $dl;
|
|
||||||
return ($dl['download_author_website']) ? LAN_dl_31 : "";
|
|
||||||
SC_END
|
|
||||||
|
|
||||||
SC_BEGIN DOWNLOAD_VIEW_DATE_LAN
|
|
||||||
global $dl;
|
|
||||||
return ($dl['download_datestamp']) ? LAN_DATE : "";
|
|
||||||
SC_END
|
|
||||||
|
|
||||||
SC_BEGIN DOWNLOAD_VIEW_IMAGE_LAN
|
|
||||||
return LAN_IMAGE;
|
|
||||||
SC_END
|
|
||||||
|
|
||||||
SC_BEGIN DOWNLOAD_VIEW_REQUESTED
|
|
||||||
global $dl;
|
|
||||||
return $dl['download_requested'];
|
|
||||||
SC_END
|
|
||||||
|
|
||||||
SC_BEGIN DOWNLOAD_VIEW_RATING_LAN
|
|
||||||
return LAN_RATING;
|
|
||||||
SC_END
|
|
||||||
|
|
||||||
SC_BEGIN DOWNLOAD_VIEW_FILESIZE_LAN
|
|
||||||
return LAN_SIZE;
|
|
||||||
SC_END
|
|
||||||
|
|
||||||
SC_BEGIN DOWNLOAD_VIEW_DESCRIPTION_LAN
|
|
||||||
return LAN_DESCRIPTION;
|
|
||||||
SC_END
|
|
||||||
|
|
||||||
SC_BEGIN DOWNLOAD_VIEW_REQUESTED_LAN
|
|
||||||
return LAN_dl_77;
|
|
||||||
SC_END
|
|
||||||
|
|
||||||
SC_BEGIN DOWNLOAD_VIEW_LINK_LAN
|
|
||||||
return LAN_DOWNLOAD;
|
|
||||||
SC_END
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// ----------- Download View : Previous and Next ---------------
|
|
||||||
|
|
||||||
SC_BEGIN DOWNLOAD_VIEW_PREV
|
|
||||||
global $dl,$sql;
|
|
||||||
|
|
||||||
$dl_id = intval($dl['download_id']);
|
|
||||||
|
|
||||||
if ($sql->db_Select("download", "*", "download_category='".intval($dl['download_category_id'])."' AND download_id < {$dl_id} AND download_active > 0 && download_visible IN (".USERCLASS_LIST.") ORDER BY download_datestamp DESC LIMIT 1")) {
|
|
||||||
$row = $sql->db_Fetch();
|
|
||||||
return "<a href='".e_BASE."download.php?view.".$row['download_id']."'><< ".LAN_dl_33." [".$row['download_name']."]</a>\n";
|
|
||||||
} else {
|
|
||||||
return " ";
|
|
||||||
}
|
|
||||||
SC_END
|
|
||||||
|
|
||||||
SC_BEGIN DOWNLOAD_VIEW_NEXT
|
|
||||||
global $dl,$sql;
|
|
||||||
$dl_id = intval($dl['download_id']);
|
|
||||||
if ($sql->db_Select("download", "*", "download_category='".intval($dl['download_category_id'])."' AND download_id > {$dl_id} AND download_active > 0 && download_visible IN (".USERCLASS_LIST.") ORDER BY download_datestamp ASC LIMIT 1")) {
|
|
||||||
$row = $sql->db_Fetch();
|
|
||||||
extract($row);
|
|
||||||
return "<a href='".e_BASE."download.php?view.".$row['download_id']."'>[".$row['download_name']."] ".LAN_dl_34." >></a>\n";
|
|
||||||
} else {
|
|
||||||
return " ";
|
|
||||||
}
|
|
||||||
SC_END
|
|
||||||
|
|
||||||
|
|
||||||
SC_BEGIN DOWNLOAD_BACK_TO_LIST
|
|
||||||
global $dl;
|
|
||||||
return "<a href='".e_BASE."download.php?list.".$dl['download_category']."'>".LAN_BACK."</a>";
|
|
||||||
SC_END
|
|
||||||
|
|
||||||
SC_BEGIN DOWNLOAD_BACK_TO_CATEGORY_LIST
|
|
||||||
return "<a href='".e_SELF."'>".LAN_dl_9."</a>";
|
|
||||||
SC_END
|
|
||||||
|
|
||||||
|
|
||||||
// --------------- Download - Admin -----------------------------------
|
|
||||||
|
|
||||||
SC_BEGIN DOWNLOAD_CATEGORY_SELECT
|
|
||||||
global $sql;
|
|
||||||
$cdc = $parm;
|
|
||||||
|
|
||||||
$boxinfo = "\n";
|
|
||||||
$qry = "
|
|
||||||
SELECT dc.download_category_name, dc.download_category_order, dc.download_category_id, dc.download_category_parent,
|
|
||||||
dc1.download_category_parent AS d_parent1
|
|
||||||
FROM #download_category AS dc
|
|
||||||
LEFT JOIN #download_category as dc1 ON dc1.download_category_id=dc.download_category_parent AND dc1.download_category_class IN (".USERCLASS_LIST.")
|
|
||||||
LEFT JOIN #download_category as dc2 ON dc2.download_category_id=dc1.download_category_parent ";
|
|
||||||
if (ADMIN === FALSE) $qry .= " WHERE dc.download_category_class IN (".USERCLASS_LIST.") ";
|
|
||||||
$qry .= " ORDER by dc2.download_category_order, dc1.download_category_order, dc.download_category_order"; // This puts main categories first, then sub-cats, then sub-sub cats
|
|
||||||
|
|
||||||
if (!$sql->gen($qry))
|
|
||||||
{
|
|
||||||
return "Error reading categories<br />";
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$boxinfo .= "<select name='download_category' id='download_category' class='tbox form-control' required>
|
|
||||||
<option value=''> </option>\n";
|
|
||||||
|
|
||||||
// Its a structured display option - need a 2-step process to create a tree
|
|
||||||
$catlist = array();
|
|
||||||
while ($row = $sql->db_Fetch())
|
|
||||||
{
|
|
||||||
$tmp = $row['download_category_parent'];
|
|
||||||
if ($tmp == '0')
|
|
||||||
{
|
|
||||||
$row['subcats'] = array();
|
|
||||||
$catlist[$row['download_category_id']] = $row;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (isset($catlist[$tmp]))
|
|
||||||
{ // Sub-Category
|
|
||||||
$catlist[$tmp]['subcats'][$row['download_category_id']] = $row;
|
|
||||||
$catlist[$tmp]['subcats'][$row['download_category_id']]['subsubcats'] = array();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{ // Its a sub-sub category
|
|
||||||
if (isset($catlist[$row['d_parent1']]['subcats'][$tmp]))
|
|
||||||
{
|
|
||||||
$catlist[$row['d_parent1']]['subcats'][$tmp]['subsubcats'][$row['download_category_id']] = $row;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Now generate the options
|
|
||||||
foreach ($catlist as $thiscat)
|
|
||||||
{ // Main categories
|
|
||||||
// Could add a display class to the group, but the default looked OK
|
|
||||||
|
|
||||||
if(count($thiscat['subcats'])>0)
|
|
||||||
{
|
|
||||||
$boxinfo .= "<optgroup label='".htmlspecialchars($thiscat['download_category_name'])."'>\n";
|
|
||||||
$scprefix = '';
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$sel = ($cdc == $thiscat['download_category_id']) ? " selected='selected'" : "";
|
|
||||||
$boxinfo .= "<option value='".$thiscat['download_category_id']."' {$sel}>".htmlspecialchars($thiscat['download_category_name'])."</option>\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($thiscat['subcats'] as $sc)
|
|
||||||
{ // Sub-categories
|
|
||||||
$sscprefix = '--> ';
|
|
||||||
$boxinfo .= "<option value='".$sc['download_category_id']."'";
|
|
||||||
if ($cdc == $sc['download_category_id']) { $boxinfo .= " selected='selected'"; }
|
|
||||||
$boxinfo .= ">".$scprefix.htmlspecialchars($sc['download_category_name'])."</option>\n";
|
|
||||||
foreach ($sc['subsubcats'] as $ssc)
|
|
||||||
{ // Sub-sub categories
|
|
||||||
$boxinfo .= "<option value='".$ssc['download_category_id']."'";
|
|
||||||
if ($cdc == $ssc['download_category_id']) { $boxinfo .= " selected='selected'"; }
|
|
||||||
$boxinfo .= ">".htmlspecialchars($sscprefix.$ssc['download_category_name'])."</option>\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$boxinfo .= "</optgroup>\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
$boxinfo .= "</select>\n";
|
|
||||||
return $boxinfo;
|
|
||||||
|
|
||||||
SC_END
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
*/
|
|
||||||
?>
|
|
@@ -316,6 +316,7 @@ class e_bbcode
|
|||||||
if (is_array($this->bbList) && array_key_exists($code, $this->bbList))
|
if (is_array($this->bbList) && array_key_exists($code, $this->bbList))
|
||||||
{ // Check the bbcode 'cache'
|
{ // Check the bbcode 'cache'
|
||||||
$bbcode = $this->bbList[$code];
|
$bbcode = $this->bbList[$code];
|
||||||
|
$debugFile = "(cached)";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ // Find the file
|
{ // Find the file
|
||||||
@@ -355,14 +356,13 @@ class e_bbcode
|
|||||||
|
|
||||||
if (E107_DEBUG_LEVEL)
|
if (E107_DEBUG_LEVEL)
|
||||||
{
|
{
|
||||||
global $db_debug;
|
|
||||||
|
|
||||||
$info = array(
|
$info = array(
|
||||||
'class' =>$className,
|
'class' =>$className,
|
||||||
'path' => $debugFile
|
'path' => $debugFile,
|
||||||
|
// 'text' => $full_text
|
||||||
);
|
);
|
||||||
|
|
||||||
$db_debug->logCode(1, $code, $parm, print_a($info,true));
|
e107::getDebug()->logCode(1, $code, $parm, print_a($info,true));
|
||||||
}
|
}
|
||||||
|
|
||||||
global $e107_debug;
|
global $e107_debug;
|
||||||
|
@@ -514,8 +514,8 @@ class e107_db_debug {
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>\n";
|
<tbody>\n";
|
||||||
|
|
||||||
$description = array(1=>'Bbcode',2=>'Shortcode',3=>'Wrapper', 4=>'Shortcode Override');
|
$description = array(1=>'Bbcode',2=>'Shortcode',3=>'Wrapper', 4=>'Shortcode Override', -2 => 'Shortcode Failure');
|
||||||
$style = array(1 => 'label-info', 2=>'label-primary', 3=>'label-warning', 'label-danger');
|
$style = array(1 => 'label-info', 2=>'label-primary', 3=>'label-warning', 'label-danger', -2 => 'label-danger');
|
||||||
|
|
||||||
foreach($this -> scbbcodes as $codes)
|
foreach($this -> scbbcodes as $codes)
|
||||||
{
|
{
|
||||||
|
@@ -829,10 +829,6 @@ class e_parse extends e_parser
|
|||||||
*/
|
*/
|
||||||
function parseTemplate($text, $parseSCFiles = true, $extraCodes = null, $eVars = null)
|
function parseTemplate($text, $parseSCFiles = true, $extraCodes = null, $eVars = null)
|
||||||
{
|
{
|
||||||
if(!empty($extraCodes) && $this->isSimpleParse($extraCodes)) // support for a combined simple and standard template parse. - (eg. used by signup email template.)
|
|
||||||
{
|
|
||||||
$text = $this->simpleParse($text, $extraCodes, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!is_bool($parseSCFiles))
|
if(!is_bool($parseSCFiles))
|
||||||
{
|
{
|
||||||
|
@@ -361,7 +361,7 @@ class e_db_mysql
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @return void
|
* @return void
|
||||||
* @param unknown $sMarker
|
* @param string $sMarker
|
||||||
* @desc Enter description here...
|
* @desc Enter description here...
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
|
@@ -28,80 +28,85 @@ if (!defined('e107_INIT'))
|
|||||||
* e_shortcode - abstract batch class
|
* e_shortcode - abstract batch class
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FIXME: to be removed
|
* @deprecated
|
||||||
*/
|
* @param $classFunc
|
||||||
function register_shortcode($classFunc, $codes, $path = '', $force = false)
|
* @param $codes
|
||||||
{
|
* @param string $path
|
||||||
return e107::getScParser()->registerShortcode($classFunc, $codes, $path, $force);
|
* @param bool $force
|
||||||
}
|
* @return e_parse_shortcode
|
||||||
|
*/
|
||||||
|
function register_shortcode($classFunc, $codes, $path = '', $force = false)
|
||||||
|
{
|
||||||
|
return e107::getScParser()->registerShortcode($classFunc, $codes, $path, $force);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FIXME: to be removed
|
* @deprecated
|
||||||
*/
|
* @param $className
|
||||||
function setScVar($className, $scVarName, $value)
|
* @param $scVarName
|
||||||
{
|
* @param $value
|
||||||
return e107::getScParser()->setScVar($className, $scVarName, $value);
|
* @return e_parse_shortcode
|
||||||
}
|
*/
|
||||||
|
function setScVar($className, $scVarName, $value)
|
||||||
|
{
|
||||||
|
return e107::getScParser()->setScVar($className, $scVarName, $value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated FIXME: to be removed (once event calendar changed)
|
||||||
|
* @param $className
|
||||||
|
* @param $scFuncName
|
||||||
|
* @param string $param
|
||||||
|
* @return bool|mixed
|
||||||
|
*/
|
||||||
|
function callScFunc($className, $scFuncName, $param = '')
|
||||||
|
{
|
||||||
|
return e107::getScParser()->callScFunc($className, $scFuncName, $param);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated FIXME: to be removed
|
||||||
|
* @param $class
|
||||||
|
* @param bool $force
|
||||||
|
* @param null $eVars
|
||||||
|
* @return e_shortcode
|
||||||
|
*/
|
||||||
|
function initShortcodeClass($class, $force = false, $eVars = null)
|
||||||
|
{
|
||||||
|
return e107::getScParser()->initShortcodeClass($class, $eVars, $force);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* FIXME: to be removed (once event calendar changed)
|
|
||||||
*/
|
|
||||||
function callScFunc($className, $scFuncName, $param = '')
|
|
||||||
{
|
|
||||||
return e107::getScParser()->callScFunc($className, $scFuncName, $param);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* FIXME: to be removed
|
|
||||||
*/
|
|
||||||
function initShortcodeClass($class, $force = false, $eVars = null)
|
|
||||||
{
|
|
||||||
return e107::getScParser()->initShortcodeClass($class, $eVars, $force);
|
|
||||||
}
|
|
||||||
|
|
||||||
class e_parse_shortcode
|
class e_parse_shortcode
|
||||||
{
|
{
|
||||||
protected $scList = array(); // The actual code - added by parsing files or when plugin codes encountered. Array key is the shortcode name.
|
protected $scList = array(); // The actual code - added by parsing files or when plugin codes encountered. Array key is the shortcode name.
|
||||||
protected $parseSCFiles; // True if individual shortcode files are to be used
|
protected $parseSCFiles = true; // True if individual shortcode files are to be used
|
||||||
protected $addedCodes = NULL; // Pointer to a class or array to be used on a single call
|
protected $addedCodes = null; // Pointer to a class or array to be used on a single call
|
||||||
protected $registered_codes = array(); // Shortcodes added by plugins TODO make it private
|
protected $registered_codes = array(); // Shortcodes added by plugins TODO make it private
|
||||||
protected $scClasses = array(); // Batch shortcode classes - TODO make it private
|
protected $scClasses = array(); // Batch shortcode classes - TODO make it private
|
||||||
protected $scOverride = array(); // Array of codes found in override/shortcodes dir
|
protected $scOverride = array(); // Array of codes found in override/shortcodes dir
|
||||||
protected $scBatchOverride = array(); // Array of codes found in override/shortcodes/batch dir
|
protected $scBatchOverride = array(); // Array of codes found in override/shortcodes/batch dir
|
||||||
protected $ignoreCodes = array(); // Shortcodes to be ignored and remain unchanged. (ie. {THEME}, {e_PLUGIN} etc. )
|
protected $ignoreCodes = array(); // Shortcodes to be ignored and remain unchanged. (ie. {THEME}, {e_PLUGIN} etc. )
|
||||||
protected $addonOverride = array(); // Overrides coming from e_shortcode.php
|
protected $addonOverride = array(); // Overrides coming from e_shortcode.php
|
||||||
/**
|
private $legacyBatch = array(); // List of legacy batch file codes. eg. using SC_BEGIN etc.
|
||||||
* @var e_vars
|
private $debug_legacy = array();
|
||||||
*/
|
protected $eVars = null;
|
||||||
protected $eVars = null;
|
protected $wrappers = array(); // Wrappers array for the current parsing cycle, see contact_template.php and $CONTACT_WRAPPER variable
|
||||||
|
protected $wrapper = null; // current wrapper being processed.
|
||||||
/**
|
protected $wrapperDebugDone = array(); // Flag to avoid repetition of debug info.
|
||||||
* Wrappers array for the current parsing cycle, see contact_template.php and $CONTACT_WRAPPER variable
|
protected $sc_style = array(); // Former $sc_style global variable. Internally used - performance reasons
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
protected $wrappers = array();
|
|
||||||
protected $wrapper = null; // current wrapper being processed.
|
|
||||||
protected $wrapperDebugDone = array();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Former $sc_style global variable. Internally used - performance reasons
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
protected $sc_style = array();
|
|
||||||
|
|
||||||
function __construct()
|
function __construct()
|
||||||
{
|
{
|
||||||
$this->parseSCFiles = true; // Default probably never used, but make sure its defined.
|
$this->ignoreCodes = e107::getParser()->getUrlConstants(); // ignore all URL shortcodes. ie. {e_PLUGIN}
|
||||||
$this->ignoreCodes = e107::getParser()->getUrlConstants(); // ignore all URL shortcodes. ie. {e_PLUGIN}
|
|
||||||
$this->loadOverrideShortcodes();
|
$this->loadOverrideShortcodes();
|
||||||
$this->loadThemeShortcodes();
|
$this->loadThemeShortcodes();
|
||||||
$this->loadPluginShortcodes();
|
$this->loadPluginShortcodes();
|
||||||
$this->loadPluginSCFiles();
|
$this->loadPluginSCFiles();
|
||||||
//$this->loadCoreShortcodes(); DEPRECATED
|
//$this->loadCoreShortcodes(); DEPRECATED
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -172,6 +177,8 @@ class e_parse_shortcode
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add value to already registered SC object
|
* Add value to already registered SC object
|
||||||
*
|
*
|
||||||
@@ -222,9 +229,10 @@ class e_parse_shortcode
|
|||||||
*
|
*
|
||||||
* @param string $className
|
* @param string $className
|
||||||
* @param string $scFuncName
|
* @param string $scFuncName
|
||||||
* @param array $param - arguments passed to function
|
* @param array $args
|
||||||
|
* @return bool|mixed - NULL if class/method doesn't exist; otherwise whatever the function returns.
|
||||||
|
* @internal param array $param - arguments passed to function
|
||||||
*
|
*
|
||||||
* @return mixed|boolean - NULL if class/method doesn't exist; otherwise whatever the function returns.
|
|
||||||
*/
|
*/
|
||||||
protected function callScFuncA($className, $scFuncName, $args = array())
|
protected function callScFuncA($className, $scFuncName, $args = array())
|
||||||
{
|
{
|
||||||
@@ -236,6 +244,8 @@ class e_parse_shortcode
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create shortcode object - don't forget you still can use e_shortcode.php
|
* Create shortcode object - don't forget you still can use e_shortcode.php
|
||||||
*
|
*
|
||||||
@@ -279,22 +289,22 @@ class e_parse_shortcode
|
|||||||
* Normally you would use the proxy of this method - e107::getScBatch()
|
* Normally you would use the proxy of this method - e107::getScBatch()
|
||||||
* Global File Override ClassName/Path examples:
|
* Global File Override ClassName/Path examples:
|
||||||
* 1. Core signup shortcodes
|
* 1. Core signup shortcodes
|
||||||
* - Origin ClassName: signup_shortcodes
|
* - Origin ClassName: signup_shortcodes
|
||||||
* - Origin Location: core/shortcodes/batch/signup_shortcodes.php
|
* - Origin Location: core/shortcodes/batch/signup_shortcodes.php
|
||||||
* - File Override ClassName: override_signup_shortcodes
|
* - File Override ClassName: override_signup_shortcodes
|
||||||
* - File Override Location: core/override/shortcodes/batch/signup_shortcodes.php
|
* - File Override Location: core/override/shortcodes/batch/signup_shortcodes.php
|
||||||
*
|
*
|
||||||
* 2. Plugin 'gallery' global shortcode batch (e_shortcode.php)
|
* 2. Plugin 'gallery' global shortcode batch (e_shortcode.php)
|
||||||
* - Origin ClassName: gallery_shortcodes //FIXME Should be gallery_shortcode? (more below)
|
* - Origin ClassName: gallery_shortcodes //FIXME Should be gallery_shortcode? (more below)
|
||||||
* - Origin Location: plugins/gallery/e_shortcode.php
|
* - Origin Location: plugins/gallery/e_shortcode.php
|
||||||
* - File Override ClassName: override_gallery_shortcodes
|
* - File Override ClassName: override_gallery_shortcodes
|
||||||
* - File Override Location: core/override/shortcodes/batch/gallery_shortcodes.php
|
* - File Override Location: core/override/shortcodes/batch/gallery_shortcodes.php
|
||||||
*
|
*
|
||||||
* 3. Plugin 'forum' regular shortcode batch
|
* 3. Plugin 'forum' regular shortcode batch
|
||||||
* - Origin ClassName: plugin_forum_view_shortcodes //FIXME Should be forum_shortcodes? (more below)
|
* - Origin ClassName: plugin_forum_view_shortcodes //FIXME Should be forum_shortcodes? (more below)
|
||||||
* - Origin Location: plugins/forum/shortcodes/batch/view_shortcodes.php
|
* - Origin Location: plugins/forum/shortcodes/batch/view_shortcodes.php
|
||||||
* - File Override ClassName: override_plugin_forum_view_shortcodes
|
* - File Override ClassName: override_plugin_forum_view_shortcodes
|
||||||
* - File Override Location: core/override/shortcodes/batch/forum_view_shortcodes.php
|
* - File Override Location: core/override/shortcodes/batch/forum_view_shortcodes.php
|
||||||
*
|
*
|
||||||
* <code><?php
|
* <code><?php
|
||||||
* // simple use
|
* // simple use
|
||||||
@@ -308,9 +318,10 @@ class e_parse_shortcode
|
|||||||
* e107::getScParser()->getScObject('news_shortcodes', 'myplug', 'news2_shortcodes');
|
* e107::getScParser()->getScObject('news_shortcodes', 'myplug', 'news2_shortcodes');
|
||||||
* </code>
|
* </code>
|
||||||
* @param string $className
|
* @param string $className
|
||||||
* @param string $plugName if true className is used., if string, string value is used.
|
* @param null $pluginName
|
||||||
* @param string $overrideClass if true, $className is used
|
* @param string $overrideClass if true, $className is used
|
||||||
* @return e_shortcode
|
* @return e_shortcode
|
||||||
|
* @internal param string $plugName if true className is used., if string, string value is used.
|
||||||
*/
|
*/
|
||||||
public function getScObject($className, $pluginName = null, $overrideClass = null)
|
public function getScObject($className, $pluginName = null, $overrideClass = null)
|
||||||
{
|
{
|
||||||
@@ -320,8 +331,10 @@ class e_parse_shortcode
|
|||||||
e_shortcode.php = {plugin}_shortcode
|
e_shortcode.php = {plugin}_shortcode
|
||||||
{plugin}_shortcodes.php = {plugin}_shortcodes
|
{plugin}_shortcodes.php = {plugin}_shortcodes
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
$path = null;
|
||||||
|
|
||||||
if(trim($className)==""){ return; }
|
if(trim($className)==""){ return null; }
|
||||||
|
|
||||||
$_class_fname = $className;
|
$_class_fname = $className;
|
||||||
if($pluginName === TRUE) //XXX When called manually by a plugin, not e_shortcode.php eg. $sc = e107::getScBatch('faqs',TRUE); for faqs_shortcode.php with class faqs_shortcode
|
if($pluginName === TRUE) //XXX When called manually by a plugin, not e_shortcode.php eg. $sc = e107::getScBatch('faqs',TRUE); for faqs_shortcode.php with class faqs_shortcode
|
||||||
@@ -625,6 +638,9 @@ class e_parse_shortcode
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Common Auto-Register function for class methods.
|
* Common Auto-Register function for class methods.
|
||||||
|
* @param $class
|
||||||
|
* @param $path
|
||||||
|
* @param bool $force
|
||||||
* @return e_parse_shortcode
|
* @return e_parse_shortcode
|
||||||
*/
|
*/
|
||||||
protected function registerClassMethods($class, $path, $force = false)
|
protected function registerClassMethods($class, $path, $force = false)
|
||||||
@@ -735,8 +751,7 @@ class e_parse_shortcode
|
|||||||
* ONLY globally register shortcodes when they are declared in e_shortcode.php - this is consistent with the logic of e_xxxx which affect e107 Outside of the plugin/sript. (gallery plugin follows this logic)
|
* ONLY globally register shortcodes when they are declared in e_shortcode.php - this is consistent with the logic of e_xxxx which affect e107 Outside of the plugin/sript. (gallery plugin follows this logic)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
if(isset($sc_style) && is_array($sc_style))
|
if(isset($sc_style) && is_array($sc_style))
|
||||||
{
|
{
|
||||||
$this->sc_style = array_merge($sc_style, $this->sc_style); // XXX Commenting this out will fix #2 above.
|
$this->sc_style = array_merge($sc_style, $this->sc_style); // XXX Commenting this out will fix #2 above.
|
||||||
@@ -814,8 +829,8 @@ class e_parse_shortcode
|
|||||||
$this->addedCodes = $saveCodes;
|
$this->addedCodes = $saveCodes;
|
||||||
$this->eVars = $saveVars; // restore eVars
|
$this->eVars = $saveVars; // restore eVars
|
||||||
$this->debug_legacy = null;
|
$this->debug_legacy = null;
|
||||||
|
$this->legacyBatch = array();
|
||||||
|
|
||||||
// $this->sc_style = array(); //XXX Adding this will also fix #2 above.
|
// $this->sc_style = array(); //XXX Adding this will also fix #2 above.
|
||||||
|
|
||||||
|
|
||||||
@@ -824,12 +839,14 @@ class e_parse_shortcode
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Callback looks up and substitutes a shortcode
|
* Callback looks up and substitutes a shortcode
|
||||||
|
* @param $matches
|
||||||
|
* @return bool|int|mixed|string
|
||||||
*/
|
*/
|
||||||
function doCode($matches)
|
function doCode($matches)
|
||||||
{
|
{
|
||||||
// print_a($matches);
|
// print_a($matches);
|
||||||
|
|
||||||
if(in_array($matches[0],$this->ignoreCodes)) // Ignore all {e_PLUGIN}, {THEME} etc. otherwise it will just return blank for these items.
|
if(in_array($matches[0],$this->ignoreCodes)) // Ignore all {e_PLUGIN}, {THEME} etc. otherwise it will just return blank for these items.
|
||||||
{
|
{
|
||||||
return $matches[0];
|
return $matches[0];
|
||||||
@@ -896,7 +913,7 @@ class e_parse_shortcode
|
|||||||
|
|
||||||
if (E107_DBG_BBSC || E107_DBG_SC || E107_DBG_TIMEDETAILS)
|
if (E107_DBG_BBSC || E107_DBG_SC || E107_DBG_TIMEDETAILS)
|
||||||
{
|
{
|
||||||
$sql->db_Mark_Time("SC $code");
|
$sql->db_Mark_Time("SC ".$code);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (E107_DBG_SC)
|
if (E107_DBG_SC)
|
||||||
@@ -942,10 +959,22 @@ class e_parse_shortcode
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elseif (is_array($this->addedCodes) && array_key_exists($code, $this->addedCodes)) // Its array-based shortcode. Load the code for evaluation later.
|
elseif(is_array($this->addedCodes) && array_key_exists($code, $this->addedCodes)) // Its array-based shortcode. Load the code for evaluation later.
|
||||||
{
|
{
|
||||||
|
|
||||||
$ret = $this->addedCodes[$code];
|
// $ret = $this->addedCodes[$code];
|
||||||
|
|
||||||
|
//$this->legacyBatch
|
||||||
|
if(in_array($code,$this->legacyBatch))
|
||||||
|
{
|
||||||
|
$scCode = $this->addedCodes[$code];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$ret = $this->addedCodes[$code];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// $_class = "n/a";
|
// $_class = "n/a";
|
||||||
// $_function = "n/a";
|
// $_function = "n/a";
|
||||||
$_type = 'array';
|
$_type = 'array';
|
||||||
@@ -1079,11 +1108,14 @@ class e_parse_shortcode
|
|||||||
|
|
||||||
if(!empty($scFile))
|
if(!empty($scFile))
|
||||||
{
|
{
|
||||||
|
$_type = 'file';
|
||||||
|
|
||||||
if(file_exists($scFile))
|
if(file_exists($scFile))
|
||||||
{
|
{
|
||||||
$scCode = file_get_contents($scFile);
|
$scCode = file_get_contents($scFile);
|
||||||
$this->scList[$code] = $scCode;
|
$this->scList[$code] = $scCode;
|
||||||
$_path = $scFile;
|
$_path = $scFile;
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1111,28 +1143,31 @@ class e_parse_shortcode
|
|||||||
|
|
||||||
if ($scCode) // legacy shortode to be evaluated.
|
if ($scCode) // legacy shortode to be evaluated.
|
||||||
{
|
{
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
$ret = @eval($scCode);
|
$ret = @eval($scCode);
|
||||||
}
|
}
|
||||||
catch (Throwable $t) { // Executed only in PHP 7, will not match in PHP 5.x
|
catch (Throwable $t) { // Executed only in PHP 7, will not match in PHP 5.x
|
||||||
|
|
||||||
$string = print_a($scCode,true);
|
$error = $this->debug_legacy;
|
||||||
$string .= "<h4>Added Coded</h4>";
|
$error['code'] = $code;
|
||||||
$string .= print_a($this->addedCodes,true);
|
$error['problem'] = $scCode;
|
||||||
e107::getMessage()->addDebug('Could not parse Shortcode '.$scFile.' :: {'.$code .'} '.$string);
|
|
||||||
|
e107::getDebug()->logCode(-2, $code, null, print_a($error,true));
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception $e)
|
|
||||||
{
|
|
||||||
echo $e->getMessage();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if($ret === false && E107_DEBUG_LEVEL > 0 ) // Error in Code.
|
||||||
if($ret === false && E107_DEBUG_LEVEL > 0) // Error in Code.
|
|
||||||
{
|
{
|
||||||
// $string = print_a($scCode,true);
|
|
||||||
// e107::getMessage()->addDebug('Could not parse Shortcode '.$scFile.' :: {'.$code .'} '.$string);
|
$error = $this->debug_legacy;
|
||||||
|
$error['code'] = $code;
|
||||||
|
$error['problem'] = $scCode;
|
||||||
|
$error['error'] = error_get_last();
|
||||||
|
|
||||||
|
e107::getDebug()->logCode(-2, $code, null, print_a($error,true));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1262,15 +1297,23 @@ class e_parse_shortcode
|
|||||||
return isset($ret) ? $ret : '';
|
return isset($ret) ? $ret : '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $fname
|
||||||
|
* @param string $type
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
function parse_scbatch($fname, $type = 'file')
|
function parse_scbatch($fname, $type = 'file')
|
||||||
{
|
{
|
||||||
global $e107cache, $eArrayStorage;
|
// global $e107cache, $eArrayStorage;
|
||||||
$cur_shortcodes = array();
|
$cur_shortcodes = array();
|
||||||
if ($type == 'file')
|
if ($type == 'file')
|
||||||
{
|
{
|
||||||
$batch_cachefile = 'nomd5_scbatch_'.md5($fname);
|
$batch_cachefile = 'nomd5_scbatch_'.md5($fname);
|
||||||
// $cache_filename = $e107cache->cache_fname("nomd5_{$batchfile_md5}");
|
// $cache_filename = $e107cache->cache_fname("nomd5_{$batchfile_md5}");
|
||||||
$sc_cache = $e107cache->retrieve_sys($batch_cachefile);
|
$sc_cache = e107::getCache()->retrieve_sys($batch_cachefile);
|
||||||
if (!$sc_cache)
|
if (!$sc_cache)
|
||||||
{
|
{
|
||||||
$sc_batch = file($fname);
|
$sc_batch = file($fname);
|
||||||
@@ -1309,8 +1352,8 @@ class e_parse_shortcode
|
|||||||
}
|
}
|
||||||
if ($type == 'file')
|
if ($type == 'file')
|
||||||
{
|
{
|
||||||
$sc_cache = $eArrayStorage->WriteArray($cur_shortcodes, false);
|
$sc_cache = e107::serialize($cur_shortcodes, false);
|
||||||
$e107cache->set_sys($batch_cachefile, $sc_cache);
|
e107::getCache()->set_sys($batch_cachefile, $sc_cache);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1332,6 +1375,10 @@ class e_parse_shortcode
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$this->legacyBatch = array_keys($cur_shortcodes);
|
||||||
|
|
||||||
return $cur_shortcodes;
|
return $cur_shortcodes;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1377,6 +1424,8 @@ class e_shortcode
|
|||||||
* which results in using the $CONTACT_WRAPPER['form'] wrapper in the parsing phase
|
* which results in using the $CONTACT_WRAPPER['form'] wrapper in the parsing phase
|
||||||
* Template cannot be loaded via include, only by getTemplate or getCoreTemplate
|
* Template cannot be loaded via include, only by getTemplate or getCoreTemplate
|
||||||
* e107::getScBatch() must be used also.
|
* e107::getScBatch() must be used also.
|
||||||
|
* @param string $id
|
||||||
|
* @return $this|null
|
||||||
*/
|
*/
|
||||||
public function wrapper($id = null)
|
public function wrapper($id = null)
|
||||||
{
|
{
|
||||||
@@ -1407,10 +1456,12 @@ class e_shortcode
|
|||||||
$this->var = $eVars;
|
$this->var = $eVars;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Alias of setParserVars - Preferred use by Plugins.
|
* Alias of setParserVars - Preferred use by Plugins.
|
||||||
* Sets the value of $sc->var
|
* Sets the value of $sc->var
|
||||||
|
* @param $eVars
|
||||||
|
* @return e_shortcode
|
||||||
*/
|
*/
|
||||||
public function setVars($eVars) // Alias of setParserVars();
|
public function setVars($eVars) // Alias of setParserVars();
|
||||||
{
|
{
|
||||||
|
@@ -13,21 +13,21 @@
|
|||||||
|
|
||||||
class theme_shortcodes extends e_shortcode
|
class theme_shortcodes extends e_shortcode
|
||||||
{
|
{
|
||||||
public $override = true;
|
// public $override = true;
|
||||||
|
|
||||||
function __construct()
|
function __construct()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
function sc_news_summary()
|
function sc_news_summary()
|
||||||
{
|
{
|
||||||
$sc = e107::getScBatch('news');
|
$sc = e107::getScBatch('news');
|
||||||
$data = $sc->getScVar('news_item');
|
$data = $sc->getScVar('news_item');
|
||||||
|
|
||||||
return "<span class='label label-danger'>".e107::getParser()->toHTML($data['news_summary'],'BODY')."</span>";
|
return "<span class='label label-danger'>".e107::getParser()->toHTML($data['news_summary'],'BODY')."</span>";
|
||||||
}
|
}*/
|
||||||
|
|
||||||
|
|
||||||
function sc_bootstrap_branding()
|
function sc_bootstrap_branding()
|
||||||
|
Reference in New Issue
Block a user