mirror of
https://github.com/e107inc/e107.git
synced 2025-08-07 15:16:30 +02:00
Tweaked and tested single shortcodes. Added batch shortcode files fpw_shortcodes and search_shortcodes. {SEARCH} shortcode template was updated to v2 standards.
This commit is contained in:
105
e107_core/shortcodes/batch/fpw_shortcodes.php
Normal file
105
e107_core/shortcodes/batch/fpw_shortcodes.php
Normal file
@@ -0,0 +1,105 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
if(!defined('e107_INIT'))
|
||||||
|
{
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
e107::coreLan('fpw');
|
||||||
|
|
||||||
|
class fpw_shortcodes extends e_shortcode
|
||||||
|
{
|
||||||
|
|
||||||
|
private $secImg;
|
||||||
|
private $imageCode = false;
|
||||||
|
|
||||||
|
function __construct()
|
||||||
|
{
|
||||||
|
|
||||||
|
parent::__construct();
|
||||||
|
|
||||||
|
if(deftrue('USE_IMAGECODE'))
|
||||||
|
{
|
||||||
|
$this->imageCode = true;
|
||||||
|
$this->secImg = e107::getSecureImg();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function sc_fpw_username($parm = null) // used when email login is disabled
|
||||||
|
{
|
||||||
|
|
||||||
|
// return "<input class='tbox' type='text' name='username' size='40' value='' maxlength='100' />";
|
||||||
|
return e107::getForm()->text('username'); // $frm->userpicker()?
|
||||||
|
}
|
||||||
|
|
||||||
|
function sc_fpw_useremail($parm = null)
|
||||||
|
{
|
||||||
|
|
||||||
|
// return '<input class="tbox form-control" type="text" name="email" size="40" value="" maxlength="100" placeholder="Email" required="required" type="email">';
|
||||||
|
// return "<input class='tbox' type='text' name='email' size='40' value='' maxlength='100' />";
|
||||||
|
return e107::getForm()->email('email', '', 200, array('placeholder' => 'Email', 'required' => 'required'));
|
||||||
|
}
|
||||||
|
|
||||||
|
function sc_fpw_submit($parm = null)
|
||||||
|
{
|
||||||
|
|
||||||
|
// return '<button type="submit" name="pwsubmit" class="button btn btn-primary btn-block reset">'.$label.'</button>';
|
||||||
|
// return "<input class='button btn btn-primary btn-block' type='submit' name='pwsubmit' value='".$label."' />";
|
||||||
|
$label = deftrue('LAN_FPW_102', LAN_SUBMIT);
|
||||||
|
|
||||||
|
return e107::getForm()->button('pwsubmit', $label);
|
||||||
|
}
|
||||||
|
|
||||||
|
function sc_fpw_captcha_lan($parm = null)
|
||||||
|
{
|
||||||
|
|
||||||
|
return LAN_ENTER_CODE;
|
||||||
|
}
|
||||||
|
|
||||||
|
function sc_fpw_captcha_hidden($parm = null)
|
||||||
|
{
|
||||||
|
|
||||||
|
return; // no longer required - included in renderInput();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $parm
|
||||||
|
* @return mixed|null|string
|
||||||
|
*/
|
||||||
|
function sc_fpw_captcha_img($parm = '')
|
||||||
|
{
|
||||||
|
|
||||||
|
if($this->imageCode)
|
||||||
|
{
|
||||||
|
return $this->secImg->renderImage();
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $parm
|
||||||
|
* @return mixed|null|string
|
||||||
|
*/
|
||||||
|
function sc_fpw_captcha_input($parm = null)
|
||||||
|
{
|
||||||
|
|
||||||
|
if($this->imageCode)
|
||||||
|
{
|
||||||
|
return $this->secImg->renderInput();
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function sc_fpw_logo($parm = '')
|
||||||
|
{
|
||||||
|
// Unused at the moment.
|
||||||
|
}
|
||||||
|
|
||||||
|
function sc_fpw_text($parm = null)
|
||||||
|
{
|
||||||
|
return deftrue('LAN_FPW_101', "Not to worry. Just enter your email address below and we'll send you an instruction email for recovery.");
|
||||||
|
}
|
||||||
|
}
|
@@ -720,7 +720,7 @@ class news_shortcodes extends e_shortcode
|
|||||||
|
|
||||||
$class = !empty($parm['class']) ? "class='".$parm['class']."'" : '';
|
$class = !empty($parm['class']) ? "class='".$parm['class']."'" : '';
|
||||||
|
|
||||||
if ($this->news_item['news_extended'] && ($this->param['current_action'] != 'extend' || $parm == 'force'))
|
if (!empty($this->news_item) && $this->news_item['news_extended'] && ($this->param['current_action'] != 'extend' || $parm == 'force'))
|
||||||
{
|
{
|
||||||
$es = (defined('EXTENDEDSTRING')) ? EXTENDEDSTRING : LAN_MORE;
|
$es = (defined('EXTENDEDSTRING')) ? EXTENDEDSTRING : LAN_MORE;
|
||||||
$es1 = (defined('PRE_EXTENDEDSTRING')) ? PRE_EXTENDEDSTRING : '';
|
$es1 = (defined('PRE_EXTENDEDSTRING')) ? PRE_EXTENDEDSTRING : '';
|
||||||
|
30
e107_core/shortcodes/batch/search_shortcodes.php
Normal file
30
e107_core/shortcodes/batch/search_shortcodes.php
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
if(!defined('e107_INIT'))
|
||||||
|
{
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class search_shortcodes extends e_shortcode
|
||||||
|
{
|
||||||
|
function sc_search_input($parm=null)
|
||||||
|
{
|
||||||
|
$size = !empty($parm['size']) ? $parm['size'] : 20;
|
||||||
|
$class = isset($parm['class']) ? $parm['class'] : 'tbox search';
|
||||||
|
|
||||||
|
return e107::getForm()->text('q','', 50, ['size'=>$size, 'class'=>$class]);
|
||||||
|
// return "<input class='tbox form-control search' type='text' name='q' size='20' value='' maxlength='50' />";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function sc_search_button($parm=null)
|
||||||
|
{
|
||||||
|
$class = isset($parm['class']) ? $parm['class'] : 'btn-default btn-secondary button search';
|
||||||
|
return e107::getForm()->button('s','Search','submit', LAN_SEARCH, ['class'=>$class]);
|
||||||
|
// return "<input class='btn btn-default btn-secondary button search' type='submit' name='s' value=\"".LAN_SEARCH."\" />";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@@ -467,6 +467,11 @@ class signup_shortcodes extends e_shortcode
|
|||||||
|
|
||||||
function sc_signup_extended_user_fields($parm = null)
|
function sc_signup_extended_user_fields($parm = null)
|
||||||
{
|
{
|
||||||
|
if(empty($this->template['extended-user-fields']))
|
||||||
|
{
|
||||||
|
return (ADMIN) ? "SIGNUP 'extended-user-fields' template not defined" : '';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$text = "";
|
$text = "";
|
||||||
|
|
||||||
|
@@ -4,7 +4,14 @@ function custom_shortcode($parm)
|
|||||||
$pref = e107::getPref();
|
$pref = e107::getPref();
|
||||||
$tp = e107::getParser();
|
$tp = e107::getParser();
|
||||||
$e107 = e107::getInstance();
|
$e107 = e107::getInstance();
|
||||||
$custom_query = explode('+', $parm);
|
|
||||||
|
$custom_query = !empty($parm) ? explode('+', $parm) : array();
|
||||||
|
|
||||||
|
if(empty($custom_query[0]))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
switch($custom_query[0])
|
switch($custom_query[0])
|
||||||
{
|
{
|
||||||
case 'login':
|
case 'login':
|
||||||
@@ -25,7 +32,7 @@ function custom_shortcode($parm)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$ret .= "<form method='post' action='".e_SELF.(e_QUERY ? '?'.e_QUERY : '')."'>\n<div class='loginc_div'>\n".LAN_LOGINMENU_1."<input class='tbox loginc user' type='text' name='username' size='15' value='$username' maxlength='20' /> \n".LAN_LOGINMENU_2."<input class='tbox loginc pass' type='password' name='userpass' size='15' value='' maxlength='20' /> \n";
|
$ret .= "<form method='post' action='".e_SELF.(e_QUERY ? '?'.e_QUERY : '')."'>\n<div class='loginc_div'>\n".LAN_LOGINMENU_1."<input class='tbox loginc user' type='text' name='username' size='15' value=\"".USERNAME."\" maxlength='20' /> \n".LAN_LOGINMENU_2."<input class='tbox loginc pass' type='password' name='userpass' size='15' value='' maxlength='20' /> \n";
|
||||||
$ret .= ($pref['user_tracking'] == "cookie") ? "<input type='checkbox' name='autologin' value='1' />".LAN_LOGINMENU_6." \n" : "";
|
$ret .= ($pref['user_tracking'] == "cookie") ? "<input type='checkbox' name='autologin' value='1' />".LAN_LOGINMENU_6." \n" : "";
|
||||||
$ret .= "<input class='btn btn-default btn-secondary button loginc' type='submit' name='userlogin' value='".LAN_LOGIN."' />";
|
$ret .= "<input class='btn btn-default btn-secondary button loginc' type='submit' name='userlogin' value='".LAN_LOGIN."' />";
|
||||||
if (intval($pref['user_reg'])===1)
|
if (intval($pref['user_reg'])===1)
|
||||||
@@ -55,7 +62,7 @@ function custom_shortcode($parm)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$quotes = file($qotdf_file);
|
$quotes = file($qotd_file);
|
||||||
$quote = $tp->toHTML($quotes[rand(0, count($quotes) -1 )], true);
|
$quote = $tp->toHTML($quotes[rand(0, count($quotes) -1 )], true);
|
||||||
}
|
}
|
||||||
return $quote;
|
return $quote;
|
||||||
@@ -74,7 +81,7 @@ function custom_shortcode($parm)
|
|||||||
{
|
{
|
||||||
$selected = ($languageFolder == e_LANGUAGE) ? ' selected="selected"' : '';
|
$selected = ($languageFolder == e_LANGUAGE) ? ' selected="selected"' : '';
|
||||||
$text .= '
|
$text .= '
|
||||||
<option value="'.$languageFolder.'"'.$selected.'>'.$languageFolder.'</option>';
|
<option value="'.$languageFolder.'" '.$selected.'>'.$languageFolder.'</option>';
|
||||||
}
|
}
|
||||||
|
|
||||||
$text .= '
|
$text .= '
|
||||||
|
@@ -1,2 +1 @@
|
|||||||
global $IMAGES_DIRECTORY;
|
return e107::getFolder('IMAGES'); // $IMAGES_DIRECTORY;
|
||||||
return $IMAGES_DIRECTORY;
|
|
||||||
|
@@ -1,14 +1,18 @@
|
|||||||
e107::includeLan(e_LANGUAGEDIR.e_LANGUAGE."/lan_user.php");
|
e107::includeLan(e_LANGUAGEDIR.e_LANGUAGE."/lan_user.php");
|
||||||
|
|
||||||
global $tp;
|
if(!is_string($parm))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
if (substr($parm, -5) === '-link')
|
if (substr($parm, -5) === '-link')
|
||||||
{
|
{
|
||||||
$parm = substr($parm, 0, -5);
|
$parm = substr($parm, 0, -5);
|
||||||
return ($user_hideemail && !ADMIN) ? "<i>".LAN_143."</i>" : $tp->toHTML($parm,TRUE);
|
return ($user_hideemail && !ADMIN) ? "<i>".LAN_143."</i>" : e107::getParser()->toHTML($parm,TRUE);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return ($user_hideemail && !ADMIN) ? "<i>".LAN_143."</i>" : $parm;
|
return ($user_hideemail && !ADMIN) ? "<i>".LAN_143."</i>" : ($parm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -5,6 +5,10 @@ if (!check_class(varset($pref['email_item_class'],e_UC_MEMBER)))
|
|||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(empty($parm))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
$parms = explode("^",$parm);
|
$parms = explode("^",$parm);
|
||||||
|
|
||||||
|
@@ -5,7 +5,12 @@ if (!USER)
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
$image = IMAGE_email;
|
if(empty($parm))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$image = defset('IMAGE_email');
|
||||||
|
|
||||||
if(is_numeric($parm))
|
if(is_numeric($parm))
|
||||||
{
|
{
|
||||||
|
@@ -1,5 +1,9 @@
|
|||||||
//this shortcode is deprecated due to a conflict with the news {EXTENDED} shortcode.
|
//this shortcode is deprecated due to a conflict with the news {EXTENDED} shortcode.
|
||||||
// Use USER_EXTENDED instead.
|
// Use USER_EXTENDED instead.
|
||||||
|
|
||||||
global $tp;
|
if(empty($parm))
|
||||||
return $tp->parseTemplate("{USER_EXTENDED=$parm}");
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return e107::getParser()->parseTemplate("{USER_EXTENDED=$parm}");
|
||||||
|
@@ -1,5 +1,10 @@
|
|||||||
//USAGE: {EXTENDED_ICON=<field_name>.<user_id>}
|
//USAGE: {EXTENDED_ICON=<field_name>.<user_id>}
|
||||||
//EXAMPLE: {EXTENDED_ICON=user_gender.5} will show the icon of the extended field user_gender for user #5
|
//EXAMPLE: {EXTENDED_ICON=user_gender.5} will show the icon of the extended field user_gender for user #5
|
||||||
|
if(empty($parm) || !is_string($parm))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
$parms = explode(".", $parm);
|
$parms = explode(".", $parm);
|
||||||
global $tp;
|
|
||||||
return $tp->parseTemplate("{USER_EXTENDED={$parms[0]}.icon.{$parms[1]}}");
|
return e107::getParser()->parseTemplate("{USER_EXTENDED={$parms[0]}.icon.{$parms[1]}}");
|
||||||
|
@@ -1,5 +1,10 @@
|
|||||||
//USAGE: {EXTENDED_TEXT=<field_name>.<user_id>}
|
//USAGE: {EXTENDED_TEXT=<field_name>.<user_id>}
|
||||||
//EXAMPLE: {EXTENDED_TEXT=user_gender.5} will show the text of the extended field user_gender for user #5
|
//EXAMPLE: {EXTENDED_TEXT=user_gender.5} will show the text of the extended field user_gender for user #5
|
||||||
|
|
||||||
|
if(empty($parm) || !is_string($parm))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
$parms = explode(".", $parm);
|
$parms = explode(".", $parm);
|
||||||
global $tp;
|
global $tp;
|
||||||
return $tp->parseTemplate("{USER_EXTENDED={$parms[0]}.text.{$parms[1]}}");
|
return e107::getParser()->parseTemplate("{USER_EXTENDED={$parms[0]}.text.{$parms[1]}}");
|
||||||
|
@@ -1,5 +1,9 @@
|
|||||||
//USAGE: {EXTENDED_VALUE=<field_name>.<user_id>}
|
//USAGE: {EXTENDED_VALUE=<field_name>.<user_id>}
|
||||||
//EXAMPLE: {EXTENDED_VALUE=user_gender.5} will show the value of the extended field user_gender for user #5
|
//EXAMPLE: {EXTENDED_VALUE=user_gender.5} will show the value of the extended field user_gender for user #5
|
||||||
|
if(empty($parm) || !is_string($parm))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
$parms = explode(".", $parm);
|
$parms = explode(".", $parm);
|
||||||
global $tp;
|
return e107::getParser()->parseTemplate("{USER_EXTENDED={$parms[0]}.value.{$parms[1]}}");
|
||||||
return $tp->parseTemplate("{USER_EXTENDED={$parms[0]}.value.{$parms[1]}}");
|
|
||||||
|
@@ -9,9 +9,16 @@
|
|||||||
|
|
||||||
function iconpicker_shortcode($parm)
|
function iconpicker_shortcode($parm)
|
||||||
{
|
{
|
||||||
|
if(empty($parm))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
$parms = array();
|
$parms = array();
|
||||||
|
|
||||||
parse_str($parm, $parms);
|
parse_str($parm, $parms);
|
||||||
$name = varset($parms['id']);
|
$name = varset($parms['id']);
|
||||||
|
|
||||||
|
|
||||||
$sql = e107::getDb();
|
$sql = e107::getDb();
|
||||||
$frm = e107::getForm();
|
$frm = e107::getForm();
|
||||||
@@ -41,7 +48,7 @@ function iconpicker_shortcode($parm)
|
|||||||
$str = "";
|
$str = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
$str .= "<a href='#".$row['media_url']."' title='{$filepath}' onclick=\"e107Helper.insertText('{$row['media_url']}','{$name}','{$name}-iconpicker'); return false; \"><img class='icon picker list%%size%%' src='".$tp->replaceConstants($row['media_url'],'abs')."' alt='{$row['media_name']}' /></a>";
|
$str .= "<a href='#".$row['media_url']."' onclick=\"e107Helper.insertText('{$row['media_url']}','{$name}','{$name}-iconpicker'); return false; \"><img class='icon picker list%%size%%' src='".$tp->replaceConstants($row['media_url'],'abs')."' alt='{$row['media_name']}' /></a>";
|
||||||
|
|
||||||
$lastsize = $size;
|
$lastsize = $size;
|
||||||
|
|
||||||
@@ -52,4 +59,3 @@ function iconpicker_shortcode($parm)
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
?>
|
|
@@ -3,6 +3,11 @@
|
|||||||
|
|
||||||
function imagepreview_shortcode($parm)
|
function imagepreview_shortcode($parm)
|
||||||
{
|
{
|
||||||
|
if(empty($parm))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
list($name, $width, $height, $nothumb) = explode("|",$parm, 4);
|
list($name, $width, $height, $nothumb) = explode("|",$parm, 4);
|
||||||
|
|
||||||
$name = rawurldecode(varset($name));//avoid warnings
|
$name = rawurldecode(varset($name));//avoid warnings
|
||||||
|
@@ -8,6 +8,11 @@ function imageselector_shortcode($parm = '', $mod = '')
|
|||||||
$sql = e107::getDb('imageselector.sc');
|
$sql = e107::getDb('imageselector.sc');
|
||||||
$tp = e107::getParser();
|
$tp = e107::getParser();
|
||||||
|
|
||||||
|
if(empty($parm))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
if (strpos($parm, "=") !== false)
|
if (strpos($parm, "=") !== false)
|
||||||
{ // query style parms.
|
{ // query style parms.
|
||||||
parse_str($parm, $parms);
|
parse_str($parm, $parms);
|
||||||
|
@@ -3,6 +3,11 @@
|
|||||||
|
|
||||||
function lan_shortcode($parm = '')
|
function lan_shortcode($parm = '')
|
||||||
{
|
{
|
||||||
|
if(empty($parm))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
$lan = trim($parm);
|
$lan = trim($parm);
|
||||||
if(defined($lan))
|
if(defined($lan))
|
||||||
{
|
{
|
||||||
|
@@ -51,10 +51,13 @@ function languagelinks_shortcode($parm = '')
|
|||||||
define('LANGLINKS_SEPARATOR', ' | ');
|
define('LANGLINKS_SEPARATOR', ' | ');
|
||||||
}
|
}
|
||||||
|
|
||||||
$tmp = explode('|', $parm, 2);
|
if(is_string($parm))
|
||||||
$parm = $tmp[0];
|
{
|
||||||
$parms = array();
|
$tmp = explode('|', $parm, 2);
|
||||||
if(isset($tmp[1])) parse_str($tmp[1], $parms);
|
$parm = $tmp[0];
|
||||||
|
$parms = array();
|
||||||
|
if(isset($tmp[1])) parse_str($tmp[1], $parms);
|
||||||
|
}
|
||||||
|
|
||||||
// ignore Query string if required by parms or external code, false by default
|
// ignore Query string if required by parms or external code, false by default
|
||||||
if(!defined('LANGLINKS_NOQUERY'))
|
if(!defined('LANGLINKS_NOQUERY'))
|
||||||
@@ -67,8 +70,6 @@ function languagelinks_shortcode($parm = '')
|
|||||||
define('LANGLINKS_HOME', isset($parms['home']));
|
define('LANGLINKS_HOME', isset($parms['home']));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*require_once(e_HANDLER.'language_class.php');
|
|
||||||
$slng = new language;*/
|
|
||||||
$slng = e107::getLanguage();
|
$slng = e107::getLanguage();
|
||||||
|
|
||||||
if(!empty($parm))
|
if(!empty($parm))
|
||||||
|
@@ -6,7 +6,12 @@ if(!defined('e107_INIT'))
|
|||||||
|
|
||||||
function menu_shortcode($parm, $mode='')
|
function menu_shortcode($parm, $mode='')
|
||||||
{
|
{
|
||||||
|
|
||||||
|
if(empty($parm))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
if(is_array($parm)) //v2.x format allowing for parms. {MENU: path=y&count=x}
|
if(is_array($parm)) //v2.x format allowing for parms. {MENU: path=y&count=x}
|
||||||
{
|
{
|
||||||
list($plugin,$menu) = explode("/",$parm['path'],2);
|
list($plugin,$menu) = explode("/",$parm['path'],2);
|
||||||
|
@@ -20,6 +20,10 @@ if(!defined('e107_INIT'))
|
|||||||
|
|
||||||
function menuarea_shortcode($parm, $mode='')
|
function menuarea_shortcode($parm, $mode='')
|
||||||
{
|
{
|
||||||
|
if(empty($parm))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return e107::getMenu()->renderArea($parm);
|
return e107::getMenu()->renderArea($parm);
|
||||||
|
|
||||||
|
@@ -15,6 +15,8 @@ $pref = e107::getPref();
|
|||||||
$tp = e107::getParser();
|
$tp = e107::getParser();
|
||||||
$scbatch = e107::getScBatch('news');
|
$scbatch = e107::getScBatch('news');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$cString = 'nq_news_categories_sc';
|
$cString = 'nq_news_categories_sc';
|
||||||
$cached = e107::getCache()->retrieve($cString);
|
$cached = e107::getCache()->retrieve($cString);
|
||||||
|
|
||||||
@@ -174,10 +176,12 @@ $nbr_cols = (defined("NEWSCAT_COLS")) ? NEWSCAT_COLS : $nbr_cols;
|
|||||||
//$row['category_name'] = $category_name;
|
//$row['category_name'] = $category_name;
|
||||||
//$row['category_icon'] = $category_icon;
|
//$row['category_icon'] = $category_icon;
|
||||||
$row = array_merge($row, $row3);
|
$row = array_merge($row, $row3);
|
||||||
|
|
||||||
$textbody .= $ix -> render_newsitem($row, 'return', '', $NEWSCAT_ITEM, $param);
|
$textbody .= $ix -> render_newsitem($row, 'return', '', $NEWSCAT_ITEM, $param);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------
|
// ----------------------------------
|
||||||
$search[0] = "/\{NEWSCATICON\}(.*?)/si";
|
$search[0] = "/\{NEWSCATICON\}(.*?)/si";
|
||||||
$replace[0] = $scbatch->sc_newscaticon('url');
|
$replace[0] = $scbatch->sc_newscaticon('url');
|
||||||
|
@@ -4,9 +4,12 @@ if(empty($parm) && is_numeric($loop_uid))
|
|||||||
{
|
{
|
||||||
$parm = $loop_uid;
|
$parm = $loop_uid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$image = '';
|
||||||
|
|
||||||
if(is_numeric($parm))
|
if(is_numeric($parm))
|
||||||
{
|
{
|
||||||
if((int) $parm == USERID)
|
if((int) $parm == USERID && deftrue('USERPHOTO'))
|
||||||
{
|
{
|
||||||
$image = USERPHOTO;
|
$image = USERPHOTO;
|
||||||
}
|
}
|
||||||
@@ -22,7 +25,12 @@ elseif($parm)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$image = USERPHOTO;
|
$image = deftrue('USERPHOTO');
|
||||||
|
}
|
||||||
|
|
||||||
|
if(empty($image))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return e107::getParser()->parseTemplate("{USER_AVATAR=".$image."}",true);
|
return e107::getParser()->parseTemplate("{USER_AVATAR=".$image."}",true);
|
||||||
|
@@ -3,6 +3,11 @@
|
|||||||
|
|
||||||
function plugin_shortcode($parm = '')
|
function plugin_shortcode($parm = '')
|
||||||
{
|
{
|
||||||
|
if(empty($parm))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
$tp = e107::getParser();
|
$tp = e107::getParser();
|
||||||
|
|
||||||
@list($menu,$parms) = explode('|',$parm.'|', 2);
|
@list($menu,$parms) = explode('|',$parm.'|', 2);
|
||||||
|
@@ -1,5 +1,9 @@
|
|||||||
//<?php
|
//<?php
|
||||||
|
|
||||||
|
if(empty($parm))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
$parms = explode("^",$parm);
|
$parms = explode("^",$parm);
|
||||||
|
|
||||||
|
@@ -1,2 +1,2 @@
|
|||||||
$id = ($parm) ? $parm : USERID;
|
$id = ($parm) ? $parm : USERID;
|
||||||
return "<a href='".e_HTTP."user.php?id.{$id}'>".IMAGE_profile."</a>";
|
return "<a href='".e_HTTP."user.php?id.{$id}'>".defset('IMAGE_profile')."</a>";
|
||||||
|
87
e107_core/shortcodes/single/search.php
Normal file
87
e107_core/shortcodes/single/search.php
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
function search_shortcode($parm=null)
|
||||||
|
{
|
||||||
|
|
||||||
|
//<?php
|
||||||
|
|
||||||
|
global $sql, $SEARCH_SHORTCODE; // in case it is declared in a v1 theme.php file.
|
||||||
|
|
||||||
|
e107::coreLan('search');
|
||||||
|
e107::includeLan(e_PLUGIN . "search_menu/languages/" . e_LANGUAGE . ".php");
|
||||||
|
|
||||||
|
|
||||||
|
$text = "";
|
||||||
|
|
||||||
|
if(!isset($SEARCH_SHORTCODE))
|
||||||
|
{
|
||||||
|
if(!$SEARCH_SHORTCODE = e107::getCoreTemplate('search','shortcode'))
|
||||||
|
{
|
||||||
|
$SEARCH_SHORTCODE = include(e107::coreTemplatePath('search'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$ref = array();
|
||||||
|
|
||||||
|
$ref['all'] = 'all';
|
||||||
|
$ref['news'] = '0';
|
||||||
|
$ref['comments'] = 1;
|
||||||
|
$ref['users'] = 2;
|
||||||
|
$ref['downloads'] = 3;
|
||||||
|
$ref['pages'] = 4;
|
||||||
|
|
||||||
|
// $search_prefs = $sysprefs -> getArray('search_prefs');
|
||||||
|
|
||||||
|
$search_prefs = e107::getConfig('search')->getPref();
|
||||||
|
|
||||||
|
|
||||||
|
if(!empty($search_prefs['plug_handlers']) && is_array($search_prefs['plug_handlers']))
|
||||||
|
{
|
||||||
|
foreach($search_prefs['plug_handlers'] as $plug_dir => $active)
|
||||||
|
{
|
||||||
|
if(is_readable(e_PLUGIN . $plug_dir . "/e_search.php"))
|
||||||
|
{
|
||||||
|
$ref[$plug_dir] = $plug_dir;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(!empty($parm) && !empty($ref[$parm]))
|
||||||
|
{
|
||||||
|
$page = $ref[$parm];
|
||||||
|
}
|
||||||
|
elseif($parm == 'all' && defined('e_PAGE') && !empty($ref[e_PAGE]))
|
||||||
|
{
|
||||||
|
$page = $ref[e_PAGE];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$page = 'all';
|
||||||
|
}
|
||||||
|
|
||||||
|
if(empty($SEARCH_SHORTCODE))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$sc = e107::getScBatch('search');
|
||||||
|
$sc->wrapper('search/shortcode');
|
||||||
|
|
||||||
|
$text .= "<form method='get' action='" . e_HTTP . "search.php'><div>\n";
|
||||||
|
$text .= "<input type='hidden' name='t' value='$page' />\n";
|
||||||
|
$text .= "<input type='hidden' name='r' value='0' />\n";
|
||||||
|
|
||||||
|
if(defined('SEARCH_SHORTCODE_REF') && SEARCH_SHORTCODE_REF != '')
|
||||||
|
{
|
||||||
|
$text .= "<input type='hidden' name='ref' value=\"" . SEARCH_SHORTCODE_REF . "\" />\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
$text .= e107::getParser()->parseTemplate($SEARCH_SHORTCODE, true, $sc);
|
||||||
|
|
||||||
|
$text .= "\n</div></form>";
|
||||||
|
|
||||||
|
return $text;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@@ -1,63 +0,0 @@
|
|||||||
//<?
|
|
||||||
global $sql,$sysprefs,$SEARCH_SHORTCODE;
|
|
||||||
|
|
||||||
e107::includeLan(e_PLUGIN."search_menu/languages/".e_LANGUAGE.".php");
|
|
||||||
$text = "";
|
|
||||||
if (!isset($SEARCH_SHORTCODE))
|
|
||||||
{
|
|
||||||
if (file_exists(THEME."templates/search_template.php"))
|
|
||||||
{
|
|
||||||
include(THEME."templates/search_template.php");
|
|
||||||
}
|
|
||||||
elseif (file_exists(THEME."search_template.php"))
|
|
||||||
{
|
|
||||||
include(THEME."search_template.php");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
include(e_CORE."templates/search_template.php");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$ref['all'] = 'all';
|
|
||||||
$ref['news'] = '0';
|
|
||||||
$ref['comments'] = 1;
|
|
||||||
$ref['users'] = 2;
|
|
||||||
$ref['downloads'] = 3;
|
|
||||||
$ref['pages'] = 4;
|
|
||||||
|
|
||||||
// $search_prefs = $sysprefs -> getArray('search_prefs');
|
|
||||||
|
|
||||||
$search_prefs = e107::getConfig('search')->getPref();
|
|
||||||
|
|
||||||
|
|
||||||
if(is_array($search_prefs['plug_handlers']))
|
|
||||||
{
|
|
||||||
foreach ($search_prefs['plug_handlers'] as $plug_dir => $active)
|
|
||||||
{
|
|
||||||
if (is_readable(e_PLUGIN.$plug_dir."/e_search.php"))
|
|
||||||
{
|
|
||||||
$ref[$plug_dir] = $plug_dir;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if($ref[$parm]!= ''){
|
|
||||||
$page = $ref[$parm];
|
|
||||||
}elseif($parm='all' && $ref[e_PAGE] != ''){
|
|
||||||
$page = $ref[e_PAGE];
|
|
||||||
}else{
|
|
||||||
$page = 'all';
|
|
||||||
}
|
|
||||||
|
|
||||||
$text .= "<form method='get' action='".e_HTTP."search.php'><div>\n";
|
|
||||||
$text .= "<input type='hidden' name='t' value='$page' />\n";
|
|
||||||
$text .= "<input type='hidden' name='r' value='0' />\n";
|
|
||||||
|
|
||||||
if (defined('SEARCH_SHORTCODE_REF') && SEARCH_SHORTCODE_REF != '') {
|
|
||||||
$text .= "<input type='hidden' name='ref' value=\"".SEARCH_SHORTCODE_REF."\" />\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
$text .= $SEARCH_SHORTCODE;
|
|
||||||
|
|
||||||
$text .="\n</div></form>";
|
|
||||||
|
|
||||||
return $text;
|
|
@@ -6,6 +6,11 @@
|
|||||||
global $style; // BC
|
global $style; // BC
|
||||||
$style = $parm; // BC
|
$style = $parm; // BC
|
||||||
|
|
||||||
|
if(empty($parm))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
e107::getRender()->setStyle($parm);
|
e107::getRender()->setStyle($parm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,8 +1,11 @@
|
|||||||
global $eMenuActive,$linkstyle;
|
global $eMenuActive,$linkstyle;
|
||||||
// PHP warnings FIX - Deprecated menus, $eMenuActive not set
|
// PHP warnings FIX - Deprecated menus, $eMenuActive not set
|
||||||
//if(!in_array('edynamic_menu',$eMenuActive) && !in_array('tree_menu',$eMenuActive) && !in_array('q_tree_menu',$eMenuActive))
|
//if(!empty($parm) && is_string($parm) && !in_array('edynamic_menu',$eMenuActive) && !in_array('tree_menu',$eMenuActive) && !in_array('q_tree_menu',$eMenuActive))
|
||||||
|
|
||||||
|
|
||||||
|
if(is_string($parm))
|
||||||
{
|
{
|
||||||
$tmp = explode(":",$parm);
|
$tmp = explode(":", $parm);
|
||||||
$linktype = $tmp[0];
|
$linktype = $tmp[0];
|
||||||
$cat = (isset($tmp[1])) ? $tmp[1] : 1;
|
$cat = (isset($tmp[1])) ? $tmp[1] : 1;
|
||||||
$css_class = (isset($tmp[2])) ? $tmp[2] : false;
|
$css_class = (isset($tmp[2])) ? $tmp[2] : false;
|
||||||
|
@@ -16,6 +16,11 @@ class sitelinks_alt
|
|||||||
static function sitelinks_alt_shortcode($parm)
|
static function sitelinks_alt_shortcode($parm)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
if(empty($parm))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
$params = explode('+', $parm);
|
$params = explode('+', $parm);
|
||||||
|
|
||||||
if (vartrue($params[0]) && ($params[0] != 'no_icons') && ($params[0] != 'default'))
|
if (vartrue($params[0]) && ($params[0] != 'no_icons') && ($params[0] != 'default'))
|
||||||
|
@@ -4,40 +4,46 @@
|
|||||||
|
|
||||||
function sublinks_shortcode($parm)
|
function sublinks_shortcode($parm)
|
||||||
{
|
{
|
||||||
global $sql,$linkstyle;;
|
|
||||||
|
|
||||||
if($parm){
|
global $sql, $linkstyle;;
|
||||||
list($page,$cat) = explode(":",$parm);
|
|
||||||
|
if($parm)
|
||||||
|
{
|
||||||
|
list($page, $cat) = explode(":", $parm);
|
||||||
}
|
}
|
||||||
|
|
||||||
$page = ($page) ? $page : e_PAGE;
|
$page = isset($page) ? $page : defset('e_PAGE');
|
||||||
$cat = ($cat) ? $cat : 1;
|
$cat = isset($cat) ? $cat : 1;
|
||||||
|
|
||||||
require_once(e_HANDLER."sitelinks_class.php");
|
require_once(e_HANDLER . "sitelinks_class.php");
|
||||||
$sublinks = new sitelinks;
|
$sublinks = new sitelinks;
|
||||||
|
|
||||||
if(function_exists("linkstyle")){
|
if(function_exists("linkstyle"))
|
||||||
$style = linkstyle($linkstyle);
|
{
|
||||||
}else{
|
$style = linkstyle($linkstyle);
|
||||||
$style="";
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$style = array('prelink' => '', 'postlink'=>'');
|
||||||
}
|
}
|
||||||
|
|
||||||
$text = "\n\n<!-- Sublinks Start -->\n\n";
|
$text = "\n\n<!-- Sublinks Start -->\n\n";
|
||||||
$text .= $style['prelink'];
|
$text .= $style['prelink'];
|
||||||
$sql->select("links", "link_id","link_url= '{$page}' AND link_category = {$cat} LIMIT 1");
|
if($sql->select("links", "link_id", "link_url= '{$page}' AND link_category = {$cat} LIMIT 1"))
|
||||||
$row = $sql->fetch();
|
|
||||||
$parent = $row['link_id'];
|
|
||||||
|
|
||||||
$link_total = $sql->select("links", "*", "link_class IN (".USERCLASS_LIST.") AND link_parent={$parent} ORDER BY link_order ASC");
|
|
||||||
while($linkInfo = $sql->fetch())
|
|
||||||
{
|
{
|
||||||
$text .= $sublinks->makeLink($linkInfo,TRUE, $style, false);
|
$row = $sql->fetch();
|
||||||
}
|
$parent = (int) $row['link_id'];
|
||||||
|
|
||||||
$text .= $style['postlink'];
|
$link_total = $sql->select("links", "*", "link_class IN (" . USERCLASS_LIST . ") AND link_parent={$parent} ORDER BY link_order ASC");
|
||||||
|
while($linkInfo = $sql->fetch())
|
||||||
|
{
|
||||||
|
$text .= $sublinks->makeLink($linkInfo, true, $style, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
$text .= $style['postlink'];
|
||||||
|
}
|
||||||
$text .= "\n\n<!-- Sublinks End -->\n\n";
|
$text .= "\n\n<!-- Sublinks End -->\n\n";
|
||||||
|
|
||||||
return $text;
|
return $text;
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
|
@@ -75,11 +75,16 @@ function uploadfile_shortcode($parm)
|
|||||||
{
|
{
|
||||||
return LAN_UPLOAD_SERVEROFF;
|
return LAN_UPLOAD_SERVEROFF;
|
||||||
}
|
}
|
||||||
if(USER_AREA === TRUE && !check_class(e107::getPref('upload_class')))
|
if(deftrue('USER_AREA') && !check_class(e107::getPref('upload_class')))
|
||||||
{
|
{
|
||||||
return LAN_DISABLED;
|
return LAN_DISABLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(empty($parm))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
$parm = explode('|', $parm, 2);
|
$parm = explode('|', $parm, 2);
|
||||||
|
|
||||||
$path = $parm[0];
|
$path = $parm[0];
|
||||||
@@ -142,15 +147,15 @@ function uploadfile_shortcode($parm)
|
|||||||
$onclickd = " onclick=\"duplicateHTML('{$parms['up_row']}','{$parms['up_container']}');\"";
|
$onclickd = " onclick=\"duplicateHTML('{$parms['up_row']}','{$parms['up_container']}');\"";
|
||||||
$name = $parms['name'].'[]';
|
$name = $parms['name'].'[]';
|
||||||
|
|
||||||
$text .="
|
$text ="
|
||||||
<!-- Upload Shortcode -->
|
<!-- Upload Shortcode -->
|
||||||
<div>
|
<div>
|
||||||
<div class='field-spacer'>
|
<div class='field-spacer'>
|
||||||
<button class='action duplicate' type='button' value='no-value'{$onclickd}><span>".LAN_UPLOAD_ADDFILE."</span></button>";
|
<button class='action duplicate' type='button' value='no-value' {$onclickd}><span>".LAN_UPLOAD_ADDFILE."</span></button>";
|
||||||
|
|
||||||
// Media Manager does the submit, not the shortcode.
|
// Media Manager does the submit, not the shortcode.
|
||||||
if(!$parms['disable_button'])
|
if(!$parms['disable_button'])
|
||||||
$text .= "<button class='upload' type='submit' name='{$parms['trigger']}' value='no-value'{$onclickt}><span>".LAN_UPLOAD_FILES."</span></button>";
|
$text .= "<button class='upload' type='submit' name='{$parms['trigger']}' value='no-value' {$onclickt}><span>".LAN_UPLOAD_FILES."</span></button>";
|
||||||
|
|
||||||
$text .= "
|
$text .= "
|
||||||
</div>
|
</div>
|
||||||
|
@@ -7,7 +7,22 @@
|
|||||||
*/
|
*/
|
||||||
function url_shortcode($parm)
|
function url_shortcode($parm)
|
||||||
{
|
{
|
||||||
list($route, $parms) = eHelper::scDualParams($parm);
|
if(empty($parm))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$tmp = eHelper::scDualParams($parm);
|
||||||
|
|
||||||
|
$route = varset($tmp[1]);
|
||||||
|
$parms = varset($tmp[2]);
|
||||||
|
|
||||||
|
if(empty($route))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// list($route, $parms) = eHelper::scDualParams($parm);
|
||||||
if(empty($route)) return '';
|
if(empty($route)) return '';
|
||||||
|
|
||||||
$options = array();
|
$options = array();
|
||||||
@@ -16,5 +31,6 @@ function url_shortcode($parm)
|
|||||||
$options = $parms['options'];
|
$options = $parms['options'];
|
||||||
unset($parms['options']);
|
unset($parms['options']);
|
||||||
}
|
}
|
||||||
|
|
||||||
return e107::getUrl()->create($route, $parms, $options);
|
return e107::getUrl()->create($route, $parms, $options);
|
||||||
}
|
}
|
||||||
|
@@ -1,147 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright e107 Inc e107.org, Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
|
|
||||||
* $Id$
|
|
||||||
*
|
|
||||||
* Extended user field shortcode
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* USAGE: {USER_EXTENDED=<field_name>.[text|value|icon|text_value].<user_id>}
|
|
||||||
* EXAMPLE: {USER_EXTENDED=user_gender.value.5} will show the value of the extended field user_gender for user #5
|
|
||||||
*/
|
|
||||||
e107::includeLan(e_LANGUAGEDIR.e_LANGUAGE.'/lan_user_extended.php');
|
|
||||||
$parms = explode('.', $parm);
|
|
||||||
global $currentUser, $tp, $loop_uid, $e107, $sc_style;
|
|
||||||
if(isset($loop_uid) && intval($loop_uid) == 0) { return ''; }
|
|
||||||
$key = $parms[0].".".$parms[1];
|
|
||||||
$sc_style['USER_EXTENDED']['pre'] = (isset($sc_style['USER_EXTENDED'][$key]['pre']) ? $sc_style['USER_EXTENDED'][$key]['pre'] : '');
|
|
||||||
$sc_style['USER_EXTENDED']['post'] = (isset($sc_style['USER_EXTENDED'][$key]['post']) ? $sc_style['USER_EXTENDED'][$key]['post'] : '');
|
|
||||||
include_once(e_HANDLER.'user_extended_class.php');
|
|
||||||
$ueStruct = e107_user_extended::user_extended_getStruct();
|
|
||||||
|
|
||||||
$uid = intval(varset($parms[2],0));
|
|
||||||
if($uid == 0)
|
|
||||||
{
|
|
||||||
if(isset($loop_uid) && intval($loop_uid) > 0)
|
|
||||||
{
|
|
||||||
$uid = $loop_uid;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$uid = USERID;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$udata = e107::user($uid);
|
|
||||||
|
|
||||||
$udata['user_class'] .= ($udata['user_class'] == '' ? '' : ',');
|
|
||||||
$udata['user_class'] .= e_UC_PUBLIC.",".e_UC_MEMBER;
|
|
||||||
if($udata['user_admin'] == 1)
|
|
||||||
{
|
|
||||||
$udata['user_class'].= ','.e_UC_ADMIN;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Need to pick up the 'miscellaneous' category - anything which isn't in a named category. Have to control visibility on a field by field basis
|
|
||||||
// And I don't think this should apply to icons
|
|
||||||
/**
|
|
||||||
* @todo - must be a better way of picking up the 'Miscellaneous' category
|
|
||||||
*/
|
|
||||||
e107::includeLan(e_LANGUAGEDIR.e_LANGUAGE.'/lan_user.php');
|
|
||||||
if (($parms[1] != 'icon') && ($parms[0] != LAN_USER_44))
|
|
||||||
{
|
|
||||||
$ret_cause = 0;
|
|
||||||
if (!check_class($ueStruct["user_".$parms[0]]['user_extended_struct_applicable'], $udata['user_class'])) $ret_cause = 1;
|
|
||||||
if (!check_class($ueStruct["user_".$parms[0]]['user_extended_struct_read'], $udata['user_class'])) $ret_cause = 2;
|
|
||||||
if (($ueStruct["user_".$parms[0]]['user_extended_struct_read'] == e_UC_READONLY && (!ADMIN && $udata['user_id'] != USERID))) $ret_cause = 3;
|
|
||||||
if ((!ADMIN && substr($ueStruct["user_".$parms[0]]['user_extended_struct_parms'], -1) == 1
|
|
||||||
&& strpos($udata['user_hidden_fields'], "^user_".$parms[0]."^") !== FALSE && $uid != USERID)) $ret_cause = 4;
|
|
||||||
if ($ret_cause != 0)
|
|
||||||
{
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if($parms[1] == 'text_value')
|
|
||||||
{
|
|
||||||
$_value = $tp->parseTemplate("{USER_EXTENDED={$parms[0]}.value}");
|
|
||||||
if($_value)
|
|
||||||
{
|
|
||||||
$__pre = (isset($sc_style['USER_EXTENDED'][$key]['pre']) ? $sc_style['USER_EXTENDED'][$key]['pre'] : '');
|
|
||||||
$__post = (isset($sc_style['USER_EXTENDED'][$key]['post']) ? $sc_style['USER_EXTENDED'][$key]['post'] : '');
|
|
||||||
$_text = $tp->parseTemplate("{USER_EXTENDED={$parms[0]}.text}");
|
|
||||||
$_mid = (isset($sc_style['USER_EXTENDED'][$key]['mid']) ? $sc_style['USER_EXTENDED'][$key]['mid'] : '');
|
|
||||||
return $__pre.$_text.$_mid.$_value.$__post;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($parms[1] == 'text')
|
|
||||||
{
|
|
||||||
$text_val = $ueStruct['user_'.$parms[0]]['user_extended_struct_text'];
|
|
||||||
if($text_val)
|
|
||||||
{
|
|
||||||
return (defined($text_val) ? constant($text_val) : $text_val);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($parms[1] == 'icon')
|
|
||||||
{
|
|
||||||
if(defined(strtoupper($parms[0]).'_ICON'))
|
|
||||||
{
|
|
||||||
return constant(strtoupper($parms[0]).'_ICON');
|
|
||||||
}
|
|
||||||
elseif(is_readable(e_IMAGE."user_icons/user_{$parms[0]}.png"))
|
|
||||||
{
|
|
||||||
return "<img src='".e_IMAGE_ABS."user_icons/user_{$parms[0]}.png' style='width:16px; height:16px' alt='' />";
|
|
||||||
}
|
|
||||||
elseif(is_readable(e_IMAGE."user_icons/{$parms[0]}.png"))
|
|
||||||
{
|
|
||||||
return "<img src='".e_IMAGE_ABS."user_icons/{$parms[0]}.png' style='width:16px; height:16px' alt='' />";
|
|
||||||
}
|
|
||||||
//return '';
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($parms[1] == 'value')
|
|
||||||
{
|
|
||||||
$uVal = str_replace(chr(1), '', $udata['user_'.$parms[0]]);
|
|
||||||
switch ($ueStruct["user_".$parms[0]]['user_extended_struct_type'])
|
|
||||||
{
|
|
||||||
case EUF_DB_FIELD : // check for db_lookup type
|
|
||||||
$tmp = explode(',',$ueStruct['user_'.$parms[0]]['user_extended_struct_values']);
|
|
||||||
$sql_ue = new db; // Use our own DB object to avoid conflicts
|
|
||||||
if($sql_ue->select($tmp[0],"{$tmp[1]}, {$tmp[2]}","{$tmp[1]} = '{$uVal}'"))
|
|
||||||
{
|
|
||||||
$row = $sql_ue->fetch();
|
|
||||||
$ret_data = $row[$tmp[2]];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$ret_data = FALSE;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case EUF_DATE : //check for 0000-00-00 in date field
|
|
||||||
if($uVal == '0000-00-00') { $uVal = ''; }
|
|
||||||
$ret_data = $uVal;
|
|
||||||
break;
|
|
||||||
case EUF_PREDEFINED : // Predefined field - have to look up display string in relevant file
|
|
||||||
$ret_data = e107_user_extended::user_extended_display_text($ueStruct['user_'.$parms[0]]['user_extended_struct_values'],$uVal);
|
|
||||||
break;
|
|
||||||
default :
|
|
||||||
$ret_data = $uVal;
|
|
||||||
}
|
|
||||||
if($ret_data != '')
|
|
||||||
{
|
|
||||||
return $tp->toHTML($ret_data, TRUE, 'no_make_clickable', "class:{$udata['user_class']}");
|
|
||||||
}
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
// return TRUE;
|
|
||||||
return FALSE;
|
|
@@ -54,4 +54,3 @@ function usersearch_shortcode($parm)
|
|||||||
$ret .= "</ul>";
|
$ret .= "</ul>";
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
?>
|
|
@@ -11,8 +11,8 @@ if (!defined('SEARCH_SHORTCODE_REF')) {
|
|||||||
|
|
||||||
if(!isset($SEARCH_SHORTCODE))
|
if(!isset($SEARCH_SHORTCODE))
|
||||||
{
|
{
|
||||||
|
//
|
||||||
$SEARCH_SHORTCODE = "<input class='tbox search' type='text' name='q' size='20' value='' maxlength='50' />
|
$SEARCH_SHORTCODE = "<input class='tbox form-control search' type='text' name='q' size='20' value='' maxlength='50' />
|
||||||
<input class='btn btn-default btn-secondary button search' type='submit' name='s' value=\"".LAN_SEARCH."\" />";
|
<input class='btn btn-default btn-secondary button search' type='submit' name='s' value=\"".LAN_SEARCH."\" />";
|
||||||
|
|
||||||
/* // Image Version Example
|
/* // Image Version Example
|
||||||
@@ -135,36 +135,36 @@ if(!isset($POST_CHECKBOXES))
|
|||||||
|
|
||||||
|
|
||||||
$SEARCH_TEMPLATE['form']['start'] = '
|
$SEARCH_TEMPLATE['form']['start'] = '
|
||||||
<form class="form-horizontal" role="form" id="searchform" method="get" action="{SEARCH_FORM_URL}">
|
<form class="form-horizontal" role="form" id="searchform" method="get" action="{SEARCH_FORM_URL}">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="inputEmail3" class="col-sm-3 control-label">'.LAN_199.'</label>
|
<label for="inputEmail3" class="col-sm-3 control-label">'.LAN_199.'</label>
|
||||||
<div class="col-sm-9">{SEARCH_MAIN}
|
<div class="col-sm-9">{SEARCH_MAIN}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="search-enhanced" {ENHANCED_DISPLAY}>
|
<div id="search-enhanced" {ENHANCED_DISPLAY}>
|
||||||
{SEARCH_ENHANCED}
|
{SEARCH_ENHANCED}
|
||||||
</div>
|
</div>
|
||||||
';
|
';
|
||||||
|
|
||||||
$SEARCH_TEMPLATE['form']['advanced'] = '
|
$SEARCH_TEMPLATE['form']['advanced'] = '
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="inputPassword3" class="col-sm-3 control-label">{SEARCH_ADV_A}</label>
|
<label for="inputPassword3" class="col-sm-3 control-label">{SEARCH_ADV_A}</label>
|
||||||
<div class="col-sm-9">
|
<div class="col-sm-9">
|
||||||
|
|
||||||
{SEARCH_ADV_B}
|
{SEARCH_ADV_B}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>';
|
</div>';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$SEARCH_TEMPLATE['form']['enhanced'] = '
|
$SEARCH_TEMPLATE['form']['enhanced'] = '
|
||||||
<div id="{ENHANCED_DISPLAY_ID}" class="form-group">
|
<div id="{ENHANCED_DISPLAY_ID}" class="form-group">
|
||||||
<label for="inputPassword3" class="col-sm-3 control-label">{ENHANCED_TEXT}</label>
|
<label for="inputPassword3" class="col-sm-3 control-label">{ENHANCED_TEXT}</label>
|
||||||
<div class="col-sm-9">
|
<div class="col-sm-9">
|
||||||
{ENHANCED_FIELD}
|
{ENHANCED_FIELD}
|
||||||
</div>
|
</div>
|
||||||
</div>';
|
</div>';
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -178,14 +178,14 @@ $SEARCH_TEMPLATE['form']['type'] = '
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
$SEARCH_TEMPLATE['form']['category'] = '
|
$SEARCH_TEMPLATE['form']['category'] = '
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="inputPassword3" class="col-sm-3 control-label">'.LAN_SEARCH_19.'</label>
|
<label for="inputPassword3" class="col-sm-3 control-label">'.LAN_SEARCH_19.'</label>
|
||||||
<div class="col-sm-9">
|
<div class="col-sm-9">
|
||||||
{SEARCH_MAIN_CHECKBOXES}{SEARCH_DROPDOWN}
|
{SEARCH_MAIN_CHECKBOXES}{SEARCH_DROPDOWN}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
{SEARCH_ADVANCED}';
|
{SEARCH_ADVANCED}';
|
||||||
|
|
||||||
$SEARCH_TEMPLATE['form']['end'] = "
|
$SEARCH_TEMPLATE['form']['end'] = "
|
||||||
</form>
|
</form>
|
||||||
@@ -194,15 +194,10 @@ $SEARCH_TEMPLATE['form']['end'] = "
|
|||||||
$SEARCH_TEMPLATE['form']['advanced-combo'] = '<div>{SEARCH_ADV_TEXT}</div>';
|
$SEARCH_TEMPLATE['form']['advanced-combo'] = '<div>{SEARCH_ADV_TEXT}</div>';
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
"<tr>
|
$SEARCH_TEMPLATE['shortcode'] = "<!-- start-search-shortcode-template -->
|
||||||
<td style='width:30%' class='forumheader3'>".LAN_SEARCH_19."<br />
|
{SEARCH_INPUT}
|
||||||
{SEARCH_MAIN_CHECKALL} {SEARCH_MAIN_UNCHECKALL}
|
{SEARCH_BUTTON}
|
||||||
</td>
|
<!-- end-search-shortcode-template -->";
|
||||||
<td style='width:70%' class='forumheader3'>
|
|
||||||
{SEARCH_MAIN_CHECKBOXES}{SEARCH_DROPDOWN} {SEARCH_ADVANCED}
|
|
||||||
<br />
|
|
||||||
</td>
|
|
||||||
</tr>";
|
|
||||||
*/
|
|
||||||
|
@@ -298,7 +298,7 @@ class comment
|
|||||||
|
|
||||||
$text .= "
|
$text .= "
|
||||||
<input type='hidden' name='subject' value='".$tp->toForm($subject)."' />
|
<input type='hidden' name='subject' value='".$tp->toForm($subject)."' />
|
||||||
<input type='hidden' name='e-token' value='".e_TOKEN."' />
|
<input type='hidden' name='e-token' value='".defset('e_TOKEN','')."' />
|
||||||
<input type='hidden' name='table' value='".$table."' />
|
<input type='hidden' name='table' value='".$table."' />
|
||||||
<input type='hidden' name='itemid' value='".$itemid."' />
|
<input type='hidden' name='itemid' value='".$itemid."' />
|
||||||
|
|
||||||
|
@@ -856,15 +856,15 @@ class e_parse_shortcode
|
|||||||
{
|
{
|
||||||
// TODO use Library Manager...
|
// TODO use Library Manager...
|
||||||
e107::js('footer', '{e_WEB}js/jquery.contenteditable.js', 'jquery', 2);
|
e107::js('footer', '{e_WEB}js/jquery.contenteditable.js', 'jquery', 2);
|
||||||
|
$token = defset('e_TOKEN','token-missing');
|
||||||
$_SESSION['editable'][e_TOKEN] = $this->editableCodes;
|
$_SESSION['editable'][$token] = $this->editableCodes;
|
||||||
|
|
||||||
e107::js('footer-inline', '$(".e-editable-front").each(function ()
|
e107::js('footer-inline', '$(".e-editable-front").each(function ()
|
||||||
{
|
{
|
||||||
|
|
||||||
var sc = $(this).attr("data-edit-sc");
|
var sc = $(this).attr("data-edit-sc");
|
||||||
var id = $(this).attr("data-edit-id");
|
var id = $(this).attr("data-edit-id");
|
||||||
var token = "'.e_TOKEN.'";
|
var token = "'.$token.'";
|
||||||
var box = $(this).parent("div, span");
|
var box = $(this).parent("div, span");
|
||||||
var container = this;
|
var container = this;
|
||||||
|
|
||||||
@@ -1334,7 +1334,7 @@ class e_parse_shortcode
|
|||||||
$error['problem'] = $scCode;
|
$error['problem'] = $scCode;
|
||||||
|
|
||||||
e107::getDebug()->logCode(-2, $code, null, print_a($error,true));
|
e107::getDebug()->logCode(-2, $code, null, print_a($error,true));
|
||||||
|
trigger_error("Couldn't parse {".$code."} legacy shortcode at line ".$t->getLine().".\n". $t->getMessage(), E_USER_NOTICE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if($ret === false && E107_DEBUG_LEVEL > 0 ) // Error in Code.
|
if($ret === false && E107_DEBUG_LEVEL > 0 ) // Error in Code.
|
||||||
|
@@ -86,11 +86,11 @@ class forum_shortcodes extends e_shortcode
|
|||||||
|
|
||||||
return "
|
return "
|
||||||
<table class='table table-bordered' style='width:100%'>\n<tr>
|
<table class='table table-bordered' style='width:100%'>\n<tr>
|
||||||
<td style='width:2%'>".IMAGE_new_small."</td>
|
<td style='width:2%'>".defset('IMAGE_new_small')."</td>
|
||||||
<td style='width:10%'><span class='smallblacktext'>".LAN_FORUM_0039."</span></td>
|
<td style='width:10%'><span class='smallblacktext'>".LAN_FORUM_0039."</span></td>
|
||||||
<td style='width:2%'>".IMAGE_nonew_small."</td>
|
<td style='width:2%'>".defset('IMAGE_nonew_small')."</td>
|
||||||
<td style='width:10%'><span class='smallblacktext'>".LAN_FORUM_0040."</span></td>
|
<td style='width:10%'><span class='smallblacktext'>".LAN_FORUM_0040."</span></td>
|
||||||
<td style='width:2%'>".IMAGE_closed_small."</td>
|
<td style='width:2%'>".defset('IMAGE_closed_small')."</td>
|
||||||
<td style='width:10%'><span class='smallblacktext'>".LAN_FORUM_0041."</span></td>
|
<td style='width:10%'><span class='smallblacktext'>".LAN_FORUM_0041."</span></td>
|
||||||
</tr>\n</table>\n";
|
</tr>\n</table>\n";
|
||||||
}
|
}
|
||||||
|
@@ -353,7 +353,7 @@
|
|||||||
'user_extended_struct_default' => 'F',
|
'user_extended_struct_default' => 'F',
|
||||||
'user_extended_struct_read' => '0',
|
'user_extended_struct_read' => '0',
|
||||||
'user_extended_struct_write' => '0',
|
'user_extended_struct_write' => '0',
|
||||||
'user_extended_struct_required' => '0',
|
'user_extended_struct_required' => '1',
|
||||||
'user_extended_struct_signup' => '0',
|
'user_extended_struct_signup' => '0',
|
||||||
'user_extended_struct_applicable' => '0',
|
'user_extended_struct_applicable' => '0',
|
||||||
'user_extended_struct_order' => '2',
|
'user_extended_struct_order' => '2',
|
||||||
@@ -774,7 +774,7 @@
|
|||||||
'user_extended_struct_default' => 'F',
|
'user_extended_struct_default' => 'F',
|
||||||
'user_extended_struct_read' => '0',
|
'user_extended_struct_read' => '0',
|
||||||
'user_extended_struct_write' => '0',
|
'user_extended_struct_write' => '0',
|
||||||
'user_extended_struct_required' => '0',
|
'user_extended_struct_required' => '1',
|
||||||
'user_extended_struct_signup' => '0',
|
'user_extended_struct_signup' => '0',
|
||||||
'user_extended_struct_applicable' => '0',
|
'user_extended_struct_applicable' => '0',
|
||||||
'user_extended_struct_order' => '2',
|
'user_extended_struct_order' => '2',
|
||||||
@@ -791,7 +791,7 @@
|
|||||||
'user_extended_struct_default' => '',
|
'user_extended_struct_default' => '',
|
||||||
'user_extended_struct_read' => '0',
|
'user_extended_struct_read' => '0',
|
||||||
'user_extended_struct_write' => '0',
|
'user_extended_struct_write' => '0',
|
||||||
'user_extended_struct_required' => '0',
|
'user_extended_struct_required' => '1',
|
||||||
'user_extended_struct_signup' => '0',
|
'user_extended_struct_signup' => '0',
|
||||||
'user_extended_struct_applicable' => '0',
|
'user_extended_struct_applicable' => '0',
|
||||||
'user_extended_struct_order' => '5',
|
'user_extended_struct_order' => '5',
|
||||||
@@ -808,7 +808,7 @@
|
|||||||
'user_extended_struct_default' => '',
|
'user_extended_struct_default' => '',
|
||||||
'user_extended_struct_read' => '0',
|
'user_extended_struct_read' => '0',
|
||||||
'user_extended_struct_write' => '0',
|
'user_extended_struct_write' => '0',
|
||||||
'user_extended_struct_required' => '0',
|
'user_extended_struct_required' => '1',
|
||||||
'user_extended_struct_signup' => '0',
|
'user_extended_struct_signup' => '0',
|
||||||
'user_extended_struct_applicable' => '0',
|
'user_extended_struct_applicable' => '0',
|
||||||
'user_extended_struct_order' => '9',
|
'user_extended_struct_order' => '9',
|
||||||
@@ -939,7 +939,7 @@
|
|||||||
'user_extended_struct_default' => 'F',
|
'user_extended_struct_default' => 'F',
|
||||||
'user_extended_struct_read' => '0',
|
'user_extended_struct_read' => '0',
|
||||||
'user_extended_struct_write' => '0',
|
'user_extended_struct_write' => '0',
|
||||||
'user_extended_struct_required' => '0',
|
'user_extended_struct_required' => '1',
|
||||||
'user_extended_struct_signup' => '0',
|
'user_extended_struct_signup' => '0',
|
||||||
'user_extended_struct_applicable' => '0',
|
'user_extended_struct_applicable' => '0',
|
||||||
'user_extended_struct_order' => '2',
|
'user_extended_struct_order' => '2',
|
||||||
@@ -956,7 +956,7 @@
|
|||||||
'user_extended_struct_default' => '',
|
'user_extended_struct_default' => '',
|
||||||
'user_extended_struct_read' => '0',
|
'user_extended_struct_read' => '0',
|
||||||
'user_extended_struct_write' => '0',
|
'user_extended_struct_write' => '0',
|
||||||
'user_extended_struct_required' => '0',
|
'user_extended_struct_required' => '1',
|
||||||
'user_extended_struct_signup' => '0',
|
'user_extended_struct_signup' => '0',
|
||||||
'user_extended_struct_applicable' => '0',
|
'user_extended_struct_applicable' => '0',
|
||||||
'user_extended_struct_order' => '5',
|
'user_extended_struct_order' => '5',
|
||||||
@@ -973,7 +973,7 @@
|
|||||||
'user_extended_struct_default' => '',
|
'user_extended_struct_default' => '',
|
||||||
'user_extended_struct_read' => '0',
|
'user_extended_struct_read' => '0',
|
||||||
'user_extended_struct_write' => '0',
|
'user_extended_struct_write' => '0',
|
||||||
'user_extended_struct_required' => '0',
|
'user_extended_struct_required' => '1',
|
||||||
'user_extended_struct_signup' => '0',
|
'user_extended_struct_signup' => '0',
|
||||||
'user_extended_struct_applicable' => '0',
|
'user_extended_struct_applicable' => '0',
|
||||||
'user_extended_struct_order' => '9',
|
'user_extended_struct_order' => '9',
|
||||||
|
@@ -164,7 +164,7 @@ class e_formTest extends \Codeception\Test\Unit
|
|||||||
e107::includeLan(e_PLUGIN.'forum/languages/English/English_front.php');
|
e107::includeLan(e_PLUGIN.'forum/languages/English/English_front.php');
|
||||||
include_once(e_CORE."templates/admin_icons_template.php");
|
include_once(e_CORE."templates/admin_icons_template.php");
|
||||||
include_once(e_PLUGIN.'forum/forum_class.php');
|
include_once(e_PLUGIN.'forum/forum_class.php');
|
||||||
include_once(e_PLUGIN.'forum/templates/forum_icons_template.php');
|
require_once(e_PLUGIN.'forum/templates/forum_icons_template.php');
|
||||||
|
|
||||||
$legacyDir = APP_PATH."/e107_files/downloadimages/";
|
$legacyDir = APP_PATH."/e107_files/downloadimages/";
|
||||||
$legacyFile = APP_PATH."/e107_files/downloadimages/butterfly.jpg";
|
$legacyFile = APP_PATH."/e107_files/downloadimages/butterfly.jpg";
|
||||||
|
@@ -541,6 +541,8 @@ class e_parse_shortcodeTest extends \Codeception\Test\Unit
|
|||||||
$this->fail($e->getMessage());
|
$this->fail($e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$sc->__construct();
|
||||||
|
|
||||||
$exclude = array('sc_signup_coppa_text'); // uses random email obfiscation.
|
$exclude = array('sc_signup_coppa_text'); // uses random email obfiscation.
|
||||||
$this->processShortcodeMethods($sc, $exclude);
|
$this->processShortcodeMethods($sc, $exclude);
|
||||||
|
|
||||||
@@ -858,7 +860,20 @@ class e_parse_shortcodeTest extends \Codeception\Test\Unit
|
|||||||
|
|
||||||
public function testFpwShortcodes() // todo move fpw shortcodes out of fpw.php to its own file.
|
public function testFpwShortcodes() // todo move fpw shortcodes out of fpw.php to its own file.
|
||||||
{
|
{
|
||||||
|
require_once(e_CORE."shortcodes/batch/fpw_shortcodes.php");
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
$sc = $this->make('fpw_shortcodes');
|
||||||
|
}
|
||||||
|
catch (Exception $e)
|
||||||
|
{
|
||||||
|
$this->fail($e->getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
$sc->__construct();
|
||||||
|
|
||||||
|
$this->processShortcodeMethods($sc);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1417,6 +1432,57 @@ class e_parse_shortcodeTest extends \Codeception\Test\Unit
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Execute all single shortcodes to check for PHP errors.
|
||||||
|
*/
|
||||||
|
public function testSingleShortcodes()
|
||||||
|
{
|
||||||
|
$list = scandir(e_CORE."shortcodes/single");
|
||||||
|
$tp = e107::getParser();
|
||||||
|
|
||||||
|
$parms = array(
|
||||||
|
'email' => 'myemail@somewhere.com-link',
|
||||||
|
'emailto' => '2',
|
||||||
|
'email_item' => 'Some Message^plugin:forum.45',
|
||||||
|
'glyph' => 'fa-anchor',
|
||||||
|
'url' => 'news/view/item|news_id=1&news_sef=sef-string&category_id=1&category_sef=category-sef&options[full]=1',
|
||||||
|
'user_extended' => 'name.text.1',
|
||||||
|
'lan' => 'LAN_EDIT',
|
||||||
|
'search' => 'all'
|
||||||
|
);
|
||||||
|
|
||||||
|
foreach($list as $sc)
|
||||||
|
{
|
||||||
|
$ext = pathinfo($sc);
|
||||||
|
$name = $ext['filename'];
|
||||||
|
|
||||||
|
if($ext['extension'] !== 'sc' && $ext['extension'] !== 'php')
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$shortcode = '{';
|
||||||
|
$shortcode .= strtoupper($name);
|
||||||
|
$shortcode .= isset($parms[$name]) ? '='.$parms[$name] : '';
|
||||||
|
$shortcode .= '}';
|
||||||
|
// echo "\n".$shortcode."\n";
|
||||||
|
$result = $tp->parseTemplate($shortcode,true);
|
||||||
|
|
||||||
|
if($name === 'search')
|
||||||
|
{
|
||||||
|
echo $result."\n\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
if(isset($parms[$name]) && $name !== 'user_extended')
|
||||||
|
{
|
||||||
|
$this->assertNotEmpty($result, $shortcode." returned nothing!");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
87
fpw.php
87
fpw.php
@@ -35,88 +35,6 @@ else
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class fpw_shortcodes extends e_shortcode
|
|
||||||
{
|
|
||||||
private $secImg;
|
|
||||||
|
|
||||||
function __construct()
|
|
||||||
{
|
|
||||||
parent::__construct();
|
|
||||||
global $sec_img;
|
|
||||||
$this->secImg = $sec_img;
|
|
||||||
}
|
|
||||||
|
|
||||||
function sc_fpw_username($parm=null) // used when email login is disabled
|
|
||||||
{
|
|
||||||
// return "<input class='tbox' type='text' name='username' size='40' value='' maxlength='100' />";
|
|
||||||
return e107::getForm()->text('username'); // $frm->userpicker()?
|
|
||||||
}
|
|
||||||
|
|
||||||
function sc_fpw_useremail($parm=null)
|
|
||||||
{
|
|
||||||
// return '<input class="tbox form-control" type="text" name="email" size="40" value="" maxlength="100" placeholder="Email" required="required" type="email">';
|
|
||||||
// return "<input class='tbox' type='text' name='email' size='40' value='' maxlength='100' />";
|
|
||||||
return e107::getForm()->email('email', '', 200, array('placeholder' => 'Email', 'required' => 'required'));
|
|
||||||
}
|
|
||||||
|
|
||||||
function sc_fpw_submit($parm=null)
|
|
||||||
{
|
|
||||||
// return '<button type="submit" name="pwsubmit" class="button btn btn-primary btn-block reset">'.$label.'</button>';
|
|
||||||
// return "<input class='button btn btn-primary btn-block' type='submit' name='pwsubmit' value='".$label."' />";
|
|
||||||
$label = deftrue('LAN_FPW_102', LAN_SUBMIT);
|
|
||||||
return e107::getForm()->button('pwsubmit', $label);
|
|
||||||
}
|
|
||||||
|
|
||||||
function sc_fpw_captcha_lan($parm=null)
|
|
||||||
{
|
|
||||||
return LAN_ENTER_CODE;
|
|
||||||
}
|
|
||||||
|
|
||||||
function sc_fpw_captcha_hidden($parm=null)
|
|
||||||
{
|
|
||||||
return; // no longer required - included in renderInput();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $parm
|
|
||||||
* @return mixed|null|string
|
|
||||||
*/
|
|
||||||
function sc_fpw_captcha_img($parm='')
|
|
||||||
{
|
|
||||||
if(USE_IMAGECODE)
|
|
||||||
{
|
|
||||||
return $this->secImg->renderImage();
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $parm
|
|
||||||
* @return mixed|null|string
|
|
||||||
*/
|
|
||||||
function sc_fpw_captcha_input($parm=null)
|
|
||||||
{
|
|
||||||
if(USE_IMAGECODE)
|
|
||||||
{
|
|
||||||
return $this->secImg->renderInput();
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
function sc_fpw_logo($parm='')
|
|
||||||
{
|
|
||||||
// Unused at the moment.
|
|
||||||
}
|
|
||||||
|
|
||||||
function sc_fpw_text($parm=null)
|
|
||||||
{
|
|
||||||
return deftrue('LAN_FPW_101',"Not to worry. Just enter your email address below and we'll send you an instruction email for recovery.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if ($pref['membersonly_enabled'])
|
if ($pref['membersonly_enabled'])
|
||||||
{
|
{
|
||||||
$sc = array (
|
$sc = array (
|
||||||
@@ -407,7 +325,6 @@ $sc = array(); // needed?
|
|||||||
|
|
||||||
if(deftrue('BOOTSTRAP'))
|
if(deftrue('BOOTSTRAP'))
|
||||||
{
|
{
|
||||||
// TODO do we want the <form> element outside the template?
|
|
||||||
$FPW_TABLE = "<form method='post' action='".SITEURL."fpw.php' autocomplete='off'>";
|
$FPW_TABLE = "<form method='post' action='".SITEURL."fpw.php' autocomplete='off'>";
|
||||||
|
|
||||||
if(getperms('0'))
|
if(getperms('0'))
|
||||||
@@ -426,7 +343,7 @@ elseif(!$FPW_TABLE)
|
|||||||
$caption = LAN_03;
|
$caption = LAN_03;
|
||||||
}
|
}
|
||||||
|
|
||||||
$sc = new fpw_shortcodes;
|
$sc = e107::getScBatch('fpw'); // fpw_shortcodes;
|
||||||
|
|
||||||
// New Shortcode names in v2. BC Fix.
|
// New Shortcode names in v2. BC Fix.
|
||||||
$bcShortcodes = array('{FPW_TABLE_SECIMG_LAN}', '{FPW_TABLE_SECIMG_HIDDEN}', '{FPW_TABLE_SECIMG_SECIMG}', '{FPW_TABLE_SECIMG_TEXTBOC}');
|
$bcShortcodes = array('{FPW_TABLE_SECIMG_LAN}', '{FPW_TABLE_SECIMG_HIDDEN}', '{FPW_TABLE_SECIMG_SECIMG}', '{FPW_TABLE_SECIMG_TEXTBOC}');
|
||||||
@@ -435,8 +352,6 @@ $FPW_TABLE = str_replace($bcShortcodes,$nwShortcodes,$FPW_TABLE);
|
|||||||
|
|
||||||
$text = $tp->parseTemplate($FPW_TABLE, true, $sc);
|
$text = $tp->parseTemplate($FPW_TABLE, true, $sc);
|
||||||
|
|
||||||
// $text = $tp->simpleParse($FPW_TABLE, $sc);
|
|
||||||
|
|
||||||
$ns->tablerender($caption, $text, 'fpw');
|
$ns->tablerender($caption, $text, 'fpw');
|
||||||
require_once(FOOTERF);
|
require_once(FOOTERF);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user