diff --git a/e107_core/shortcodes/single/user_extended.php b/e107_core/shortcodes/single/user_extended.php
index fcf15a608..bab84234e 100644
--- a/e107_core/shortcodes/single/user_extended.php
+++ b/e107_core/shortcodes/single/user_extended.php
@@ -20,17 +20,24 @@
global $loop_uid, $e107, $sc_style;
+ if(empty($parm))
+ {
+ trigger_error('{USER_EXTENDED} was sent an empty $parm',E_USER_NOTICE);
+ return null;
+ }
+
$tmp = explode('.', $parm);
- $fieldname = $tmp[0];
- $type = $tmp[1];
+
+ $fieldname = trim($tmp[0]);
+ $type = trim($tmp[1]);
$user = varset($tmp[2], 0);
- if(isset($loop_uid) && intval($loop_uid) == 0)
+ if(isset($loop_uid) && $loop_uid === 0)
{
return '';
}
- $key = $fieldname.".".$type;
+ $key = $fieldname. '.' .$type;
$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'] : '');
@@ -39,7 +46,7 @@
if($uid === 0)
{
- if(isset($loop_uid) && intval($loop_uid) > 0)
+ if(isset($loop_uid) && $loop_uid > 0)
{
$uid = $loop_uid;
}
@@ -52,7 +59,7 @@
$udata = e107::user($uid);
$udata['user_class'] .= ($udata['user_class'] == '' ? '' : ',');
- $udata['user_class'] .= e_UC_PUBLIC.",".e_UC_MEMBER;
+ $udata['user_class'] .= e_UC_PUBLIC. ',' .e_UC_MEMBER;
if(!empty($udata['user_admin']))
{
@@ -70,9 +77,9 @@
if(($type !== 'icon') && ($ue->getCategoryAttribute($fieldname, 'read') === false))
{
- $fkeyApplic = $ue->getFieldAttribute("user_" . $fieldname, 'applicable');
- $fkeyRead = $ue->getFieldAttribute("user_" . $fieldname, 'read');
- $fkeyStruct = $ue->getFieldAttribute("user_" . $fieldname, 'parms');
+ $fkeyApplic = $ue->getFieldAttribute('user_' . $fieldname, 'applicable');
+ $fkeyRead = $ue->getFieldAttribute('user_' . $fieldname, 'read');
+ $fkeyStruct = $ue->getFieldAttribute('user_' . $fieldname, 'parms');
$ret_cause = 0;
@@ -91,7 +98,7 @@
$ret_cause = 3;
}
- if((!ADMIN && substr($fkeyStruct, -1) == 1 && strpos($udata['user_hidden_fields'], "^user_" . $fieldname . "^") !== false && $uid != USERID))
+ if((!ADMIN && substr($fkeyStruct, -1) == 1 && strpos($udata['user_hidden_fields'], '^user_' . $fieldname . '^') !== false && $uid != USERID))
{
$ret_cause = 4;
}
@@ -108,8 +115,8 @@
switch($type)
{
- case "text_value":
- $_value = user_extended_shortcode($fieldname.".value.".$user);
+ case 'text_value':
+ $_value = user_extended_shortcode($fieldname. '.value.' .$user);
if($_value)
{
@@ -122,7 +129,7 @@
break;
- case "text":
+ case 'text':
if(isset($fieldname))
{
$ret = $ue->getFieldLabel($fieldname);
@@ -130,7 +137,7 @@
break;
- case "icon":
+ case 'icon':
if(defined(strtoupper($fieldname).'_ICON'))
{
$ret = constant(strtoupper($fieldname).'_ICON');
@@ -146,19 +153,24 @@
break;
- case "value":
- $uVal = isset($fieldname) && isset($udata['user_'.$fieldname]) ? str_replace(chr(1), '', $udata['user_'.$fieldname]) : '';
+ case 'value':
+ $fullField = 'user_'.$fieldname;
+ $uVal = isset($fieldname, $udata[$fullField]) ? str_replace(chr(1), '', $udata[$fullField]) : '';
if(!empty($uVal))
{
-
- $ret = $ue->renderValue($uVal, "user_".$fieldname);
+ $ret = $ue->renderValue($uVal, $fullField);
if(!empty($ret))
{
$ret = $tp->toHTML($ret, TRUE, 'no_make_clickable', "class:{$udata['user_class']}");
}
}
+ elseif(!isset($udata[$fullField]))
+ {
+ // trigger_error($fullField. ' is not defined: '.print_r($udata, true), E_USER_NOTICE);
+ }
+
break;
// code to be executed if n is different from all labels;
diff --git a/e107_handlers/e_ranks_class.php b/e107_handlers/e_ranks_class.php
index 8e8a8fb8f..255278dde 100644
--- a/e107_handlers/e_ranks_class.php
+++ b/e107_handlers/e_ranks_class.php
@@ -209,7 +209,7 @@ class e_ranks
$userData = e107::getSystemUser($userId)->getData(); //get_usXer_data($userId);
}
- if($userData['user_admin'])
+ if(isset($userData['user_admin']))
{
if($userData['user_perms'] == '0')
{
diff --git a/e107_handlers/user_extended_class.php b/e107_handlers/user_extended_class.php
index 71478e0e0..4d2b3c19c 100644
--- a/e107_handlers/user_extended_class.php
+++ b/e107_handlers/user_extended_class.php
@@ -730,7 +730,7 @@ class e107_user_extended
{
if(isset($this->fieldAttributes[$field][$att]))
{
- return e107::getParser()->toHtml($this->fieldAttributes[$field][$att],false);
+ return html_entity_decode($this->fieldAttributes[$field][$att]);
}
return false;
@@ -761,7 +761,7 @@ class e107_user_extended
{
if(!empty($this->fieldAttributes[$field]['values']))
{
- return e107::getParser()->toHTML($this->fieldAttributes[$field]['values'], false);
+ return html_entity_decode($this->fieldAttributes[$field]['values']);
}
return false;
@@ -953,7 +953,8 @@ class e107_user_extended
if(!$this->user_extended_field_exist($name))
{
- $sql->insert('user_extended_struct', $extStructInsert);
+ $nid = $sql->insert('user_extended_struct', $extStructInsert);
+ $this->init(); // rebuild the list.
// $sql->insert('user_extended_struct',"null,'".$tp -> toDB($name, true)."','".$tp -> toDB($text, true)."','".intval($type)."','".$tp -> toDB($parms, true)."','".$tp -> toDB($values, true)."', '".$tp -> toDB($default, true)."', '".intval($read)."', '".intval($write)."', '".intval($required)."', '0', '".intval($applicable)."', '".intval($order)."', '".intval($parent)."'");
}
@@ -963,7 +964,7 @@ class e107_user_extended
return true;
}
- echo $sql->getLastErrorText()."\n\n";
+ trigger_error("Extended User Field ".$name." doesn't exist", E_USER_NOTICE);
return false;
}
@@ -1128,7 +1129,7 @@ class e107_user_extended
foreach($choices as $choice)
{
$choice = trim($choice);
- $choice = $tp->toHTML($choice);
+ $choice = html_entity_decode($choice);
if(strpos($choice,"|")!==FALSE)
{
@@ -1573,7 +1574,7 @@ class e107_user_extended
if(!$result = $sql->gen($qry))
{
- $this->lastError = $sql->getLastErrorText();
+ // $this->lastError = $sql->getLastErrorText();
echo (ADMIN) ? $this->lastError : '';
}
@@ -1661,18 +1662,23 @@ class e107_user_extended
$tmp = $this->getFieldAttribute($fieldname, 'values');
$choices = explode(',', $tmp);
+ if(empty($choices))
+ {
+ trigger_error('User Extended RADIO field is missing configured selection values', E_USER_NOTICE);
+ return null;
+ }
+
foreach($choices as $choice)
{
$choice = trim($choice);
- $choice = e107::getParser()->toHTML($choice);
- if(strpos($choice,"|")!==FALSE)
+ if(strpos($choice,"|") !==false)
{
list($val,$label) = explode("|",$choice);
}
- elseif(strpos($choice," => ")!==FALSE) // new in v2.x
+ elseif(strpos($choice," => ") !==false) // new in v2.x
{
- list($val,$label) = explode(" => ",$choice);
+ list($val, $label) = explode(" => ",$choice);
}
else
{
@@ -1698,7 +1704,10 @@ class e107_user_extended
break;
case EUF_CHECKBOX:
- $value = e107::unserialize($value);
+ if(is_string($value))
+ {
+ $value = e107::unserialize($value);
+ }
if(!empty($value))
{
diff --git a/e107_plugins/forum/shortcodes/batch/view_shortcodes.php b/e107_plugins/forum/shortcodes/batch/view_shortcodes.php
index 1183ec49e..c62a65147 100644
--- a/e107_plugins/forum/shortcodes/batch/view_shortcodes.php
+++ b/e107_plugins/forum/shortcodes/batch/view_shortcodes.php
@@ -20,6 +20,7 @@ class plugin_forum_view_shortcodes extends e_shortcode
public $pref;
public $param;
+
// $param is sent from nfp menu.
function __construct()
@@ -633,9 +634,9 @@ class plugin_forum_view_shortcodes extends e_shortcode
function sc_visits()
{
- if(!empty($this->postInfo['user_name']))
+ if(!empty($this->postInfo['user_name']) && isset($this->postInfo['user_visits']))
{
- return LAN_FORUM_2033 . ': ' . varset($this->postInfo['user_visits']) . '
';
+ return LAN_FORUM_2033 . ': ' . ($this->postInfo['user_visits']) . '
';
}
}
@@ -669,7 +670,7 @@ class plugin_forum_view_shortcodes extends e_shortcode
function sc_editimg()
{
- if(USER && !empty($this->postInfo['post_user']) && $this->postInfo['post_user'] == USERID && $this->thread->threadInfo['thread_active'])
+ if(USER && !empty($this->postInfo['post_user']) && $this->postInfo['post_user'] == USERID && $this->var['thread_active'])
{
$qry = array('f' => 'edit', 'id' => $this->postInfo['post_thread'], 'post' => $this->postInfo['post_id']);
$editURL = e107::url('forum', 'post', null, array('query' => $qry));
@@ -854,8 +855,8 @@ class plugin_forum_view_shortcodes extends e_shortcode
// $text2 = $this->sc_level('special');
// $text .= $this->sc_level('pic');
-
- $ue = $tp->parseTemplate("{USER_EXTENDED=location.text_value}", true);
+ $uid = (int) $this->postInfo['post_user'];
+ $ue = $tp->parseTemplate("{USER_EXTENDED=location.text_value".$uid."}", true);
$username = (empty($this->postInfo['user_name'])) ? LAN_ANONYMOUS : $this->postInfo['user_name'];
$userUrl = empty($this->postInfo['post_user']) ? '#' : e107::getUrl()->create('user/profile/view', array('user_id' => $this->postInfo['post_user'], 'user_name' => $username));
@@ -939,7 +940,7 @@ class plugin_forum_view_shortcodes extends e_shortcode
}
// Edit
- if((USER && isset($this->postInfo['post_user']) && $this->postInfo['post_user'] == USERID && $this->thread->threadInfo['thread_active']))
+ if((USER && isset($this->postInfo['post_user']) && $this->postInfo['post_user'] == USERID && $this->var['thread_active']))
{
@@ -954,7 +955,7 @@ class plugin_forum_view_shortcodes extends e_shortcode
{
/* only show delete button when post is not the initial post of the topic
* AND if this post is the last post in the thread */
- if($this->thread->threadInfo['thread_active'] && empty($this->postInfo['thread_start']))
+ if($this->var['thread_active'] && empty($this->postInfo['thread_start']))
{
$text .= "