diff --git a/e107_core/shortcodes/batch/user_shortcodes.php b/e107_core/shortcodes/batch/user_shortcodes.php index 106a4a439..412db1a06 100644 --- a/e107_core/shortcodes/batch/user_shortcodes.php +++ b/e107_core/shortcodes/batch/user_shortcodes.php @@ -580,7 +580,7 @@ class user_shortcodes extends e_shortcode e107::setRegistry('userjump', $userjump); } - $class = empty($parms[2]['class']) ? 'e-tip' : $parms[2]['class']; + $class = empty($parms[2]['class']) ? 'e-tip page-link' : $parms[2]['class']; if($parms[1] == 'prev') { @@ -739,19 +739,25 @@ class user_shortcodes extends e_shortcode $sql = e107::getDb(); $tp = e107::getParser(); $frm = e107::getForm(); - - $template = e107::getCoreTemplate('user','extended'); - - - $EXTENDED_CATEGORY_START = $template['start']; - $EXTENDED_CATEGORY_END = $template['end']; - $EXTENDED_CATEGORY_TABLE = $template['item'];; - + + if(THEME_LEGACY === true) // v1.x + { + global $EXTENDED_CATEGORY_START, $EXTENDED_CATEGORY_END, $EXTENDED_CATEGORY_TABLE; + } + else // v2.x + { + $template = e107::getCoreTemplate('user','extended'); + $EXTENDED_CATEGORY_START = $template['start']; + $EXTENDED_CATEGORY_END = $template['end']; + $EXTENDED_CATEGORY_TABLE = $template['item'];; + } + + /* $qry = "SELECT f.*, c.user_extended_struct_name AS category_name, c.user_extended_struct_id AS category_id FROM #user_extended_struct as f LEFT JOIN #user_extended_struct as c ON f.user_extended_struct_parent = c.user_extended_struct_id ORDER BY c.user_extended_struct_order ASC, f.user_extended_struct_order ASC "; - + */ require_once(e_HANDLER."user_extended_class.php"); diff --git a/e107_core/templates/bootstrap4/user_template.php b/e107_core/templates/bootstrap4/user_template.php new file mode 100644 index 000000000..0b7a5cd08 --- /dev/null +++ b/e107_core/templates/bootstrap4/user_template.php @@ -0,0 +1,163 @@ + +
{USER_ADDON_LABEL}
+
{USER_ADDON_TEXT}
+ + '; + + $USER_TEMPLATE['extended']['start'] = ''; + $USER_TEMPLATE['extended']['end'] = ''; + + $USER_TEMPLATE['extended']['item'] = ' +
+
{EXTENDED_NAME}
+
{EXTENDED_VALUE}
+
+ '; + + + $USER_TEMPLATE['list']['start'] = " +
+
".LAN_USER_56." {TOTAL_USERS} +
+
+ {USER_FORM_START} +
+ ".LAN_SHOW.": {USER_FORM_RECORDS} ".LAN_USER_57." {USER_FORM_ORDER} + {USER_FORM_SUBMIT} +
+ {USER_FORM_END} +
+
+
+ + + + + + + + + + + {SETIMAGE: w=40} + "; + + + $USER_TEMPLATE['list']['item'] = " + + + + + + + "; + + $USER_TEMPLATE['list']['end'] = " + +
 ".LAN_USER_58."".LAN_USER_60."".LAN_USER_59."
{USER_PICTURE}{USER_ID}: {USER_NAME_LINK}{USER_EMAIL}{USER_JOIN}
+
+ "; + + + // View shortcode wrappers. + $USER_WRAPPER['view']['USER_COMMENTPOSTS'] = '
'.LAN_USER_68.'
{---}'; + $USER_WRAPPER['view']['USER_COMMENTPER'] = ' ( {---}% )
'; + $USER_WRAPPER['view']['USER_SIGNATURE'] = '
{---}
'; + $USER_WRAPPER['view']['USER_RATING'] = '
{---}
'; + $USER_WRAPPER['view']['USER_SENDPM'] = '
{---}
'; + $USER_WRAPPER['view']['PROFILE_COMMENTS'] = '
{---}
'; +// $USER_WRAPPER['view']['PROFILE_COMMENT_FORM'] = '{---} '; + + $USER_TEMPLATE['view'] = ' + {SETIMAGE: w=600} +
+
+
+
+
'.LAN_USER_58.' {USER_ID}
+
+
+ {SETIMAGE: w=200&h=200&crop=1} + {USER_PICTURE: shape=circle&link=1} +
+

{USER_NAME}

+ {USER_SIGNATURE} + {USER_RATING} + {USER_SENDPM} +
+
+
+
'.LAN_USER_63.'
{USER_REALNAME}
+
'.LAN_USER_02.'
{USER_LOGINNAME}
+
'.LAN_USER_60.'
{USER_EMAIL}
+
'.LAN_USER_54.'
{USER_LEVEL}
+
'.LAN_USER_65.'
{USER_LASTVISIT}
{USER_LASTVISIT_LAPSE}
+
'.LAN_USER_59.'
{USER_JOIN}
{USER_DAYSREGGED}
+
'.LAN_USER_66.'
{USER_VISITS}
+ {USER_ADDONS} +
{USER_COMMENTPOSTS} {USER_COMMENTPER}
+ {USER_EXTENDED_ALL} +
+
+
+ {USER_UPDATE_LINK} +
+
+
    + +
  • + +
  • + +
+
+
+ + + + +
+
+ + {PROFILE_COMMENTS} + + + '; + + + + + + + + diff --git a/e107_core/templates/header_default.php b/e107_core/templates/header_default.php index a0193c79d..eede15f35 100644 --- a/e107_core/templates/header_default.php +++ b/e107_core/templates/header_default.php @@ -761,7 +761,7 @@ if ($e107_popup != 1) { '{THEME}' => THEME_ABS, '{BODY_ONLOAD}' => $body_onload, '{LAYOUT_ID}' => 'layout-'.e107::getForm()->name2id(THEME_LAYOUT), - '{---MODAL---}' => $LAYOUT['_modal_'], + '{---MODAL---}' => (isset($LAYOUT['_modal_']) ? $LAYOUT['_modal_'] : '') , '{---HEADER---}' => $tp->parseTemplate('{HEADER}',true), '{---FOOTER---}' => $tp->parseTemplate('{FOOTER}',true), ); diff --git a/e107_core/templates/legacy/user_template.php b/e107_core/templates/legacy/user_template.php new file mode 100644 index 000000000..a0776bc41 --- /dev/null +++ b/e107_core/templates/legacy/user_template.php @@ -0,0 +1,220 @@ +{EXTENDED_NAME}"; + +$EXTENDED_CATEGORY_TABLE = " + + {EXTENDED_ICON}{EXTENDED_NAME} + + {EXTENDED_VALUE} + + "; + +$EXTENDED_CATEGORY_END = ""; + +/** + * Preparing for huge markup/css changes + */ +$USER_SHORT_TEMPLATE_START = " +
+
".LAN_USER_56." {TOTAL_USERS} +
+
+ {USER_FORM_START} +
+ ".LAN_SHOW.": {USER_FORM_RECORDS} ".LAN_USER_57." {USER_FORM_ORDER} + {USER_FORM_SUBMIT} +
+ {USER_FORM_END} +
+
+
+ + + + + + + + + + + {SETIMAGE: w=40} +"; +$USER_SHORT_TEMPLATE_END = " + +
 ".LAN_USER_58."".LAN_USER_60."".LAN_USER_59."
+
+"; + +$USER_SHORT_TEMPLATE = " + + {USER_PICTURE} + {USER_ID}: {USER_NAME_LINK} + {USER_EMAIL} + {USER_JOIN} + +"; + +$sc_style['USER_SIGNATURE']['pre'] = ""; +$sc_style['USER_SIGNATURE']['post'] = ""; + +$sc_style['USER_COMMENTS_LINK']['pre'] = ""; +$sc_style['USER_COMMENTS_LINK']['post'] = ""; + +$sc_style['USER_FORUM_LINK']['pre'] = ""; +$sc_style['USER_FORUM_LINK']['post'] = ""; + +$sc_style['USER_UPDATE_LINK']['pre'] = ""; +$sc_style['USER_UPDATE_LINK']['post'] = ""; + +$sc_style['USER_RATING']['pre'] = "
".LAN_RATING."
"; +$sc_style['USER_RATING']['post'] = "
"; + +$sc_style['USER_LOGINNAME']['pre'] = " : "; + +$sc_style['USER_COMMENTPOSTS']['pre'] = "".LAN_USER_68.""; +$sc_style['USER_COMMENTPOSTS']['post'] = ""; + +$sc_style['USER_COMMENTPER']['pre'] = " ( "; +$sc_style['USER_COMMENTPER']['post'] = "% )"; + +//FIXME TODO - Remove IF statements from template. +if(isset($pref['photo_upload']) && $pref['photo_upload']) +{ + $user_picture = "{USER_PICTURE}"; + $colspan = " colspan='2'"; + $main_colspan = ""; +} +else +{ + $user_picture = ""; + $colspan = ""; + $main_colspan = " colspan = '2' "; +} + +$sc_style['USER_SENDPM']['pre'] = "
"; +$sc_style['USER_SENDPM']['post'] = "
".LAN_USER_62."
"; + +// Determine which other bits are installed; let photo span those rows (can't do signature - will vary with user) +$span = 4; +if (e107::getParser()->parseTemplate("{USER_SENDPM}", FALSE, $user_shortcodes)) $span++; +$span = " rowspan='".$span."' "; + +//$sc_style['USER_PICTURE']['pre']=""; +//$sc_style['USER_PICTURE']['post']=""; + + + + + +$USER_FULL_TEMPLATE = "{SETIMAGE: w=250} +
+ + + + + + + + + + + + + + + + + + + + +{USER_SENDPM} +{USER_RATING} +{USER_SIGNATURE} +{USER_EXTENDED_ALL} + + + + + + + + + + + + + + +{USER_ADDONS} + +{USER_COMMENTPOSTS} +{USER_COMMENTPER} + + +{USER_UPDATE_LINK} + + + +
".LAN_USER_58." {USER_ID} : {USER_NAME}{USER_LOGINNAME}
{USER_PICTURE} +
{USER_ICON=realname} ".LAN_USER_63."
+
{USER_REALNAME}
+
+
{USER_ICON=email} ".LAN_USER_60."
+
{USER_EMAIL}
+
+
{USER_ICON=level} ".LAN_USER_54.":
+
{USER_LEVEL}
+
+
{USER_ICON=lastvisit} ".LAN_USER_65.":  
+
{USER_LASTVISIT}
{USER_LASTVISIT_LAPSE}
+
".LAN_USER_64."
".LAN_USER_59."{USER_JOIN}
{USER_DAYSREGGED}
".LAN_USER_66."{USER_VISITS}
+ + + + + +
{USER_JUMP_LINK=prev}{USER_JUMP_LINK=next}
+
+
+{PROFILE_COMMENTS} +{PROFILE_COMMENT_FORM} +"; + +$USER_EMBED_USERPROFILE_TEMPLATE = " + + {USER_ADDON_LABEL} + {USER_ADDON_TEXT} +"; + diff --git a/e107_core/templates/user_template.php b/e107_core/templates/user_template.php index 98238d4aa..7f1727640 100644 --- a/e107_core/templates/user_template.php +++ b/e107_core/templates/user_template.php @@ -15,12 +15,9 @@ */ if (!defined('e107_INIT')) { exit; } -if (!defined("USER_WIDTH")) -{ - $legacyWidth = deftrue('BOOTSTRAP') ? "" : "width:95%"; - define("USER_WIDTH", $legacyWidth); -} + +/* global $user_shortcodes, $pref, $user; //Set this to TRUE if you would like any extended user field that is empty to NOT be shown on the profile page define("HIDE_EMPTY_FIELDS", FALSE); @@ -42,9 +39,9 @@ $EXTENDED_CATEGORY_TABLE = " $EXTENDED_CATEGORY_END = ""; -/** - * Preparing for huge markup/css changes - */ + +// Preparing for huge markup/css changes + $USER_SHORT_TEMPLATE_START = "
".LAN_USER_56." {TOTAL_USERS} @@ -109,7 +106,7 @@ $sc_style['USER_COMMENTPOSTS']['post'] = ""; $sc_style['USER_COMMENTPER']['pre'] = " ( "; $sc_style['USER_COMMENTPER']['post'] = "% )"; -//FIXME TODO - Remove IF statements from template. + if(isset($pref['photo_upload']) && $pref['photo_upload']) { $user_picture = "{USER_PICTURE}"; @@ -241,13 +238,12 @@ $USER_TEMPLATE['extended']['start'] = $EXTENDED_CATEGORY_END; $USER_TEMPLATE['list']['start'] = $USER_SHORT_TEMPLATE_START; $USER_TEMPLATE['list']['item'] = $USER_SHORT_TEMPLATE; $USER_TEMPLATE['list']['end'] = $USER_SHORT_TEMPLATE_END; - +*/ // ------------ End of Legacy Code ------------------------------- // // v2.x Standards. -if(deftrue('BOOTSTRAP')) -{ + $USER_TEMPLATE = array(); // reset the legacy template above. $USER_WRAPPER = array(); // reset all the legacy wrappers above. @@ -383,7 +379,6 @@ if(deftrue('BOOTSTRAP')) '; -} @@ -392,7 +387,3 @@ if(deftrue('BOOTSTRAP')) - - - -?> \ No newline at end of file diff --git a/e107_handlers/e107_class.php b/e107_handlers/e107_class.php index 86c015c46..574433876 100644 --- a/e107_handlers/e107_class.php +++ b/e107_handlers/e107_class.php @@ -283,6 +283,10 @@ class e107 */ protected function __construct() { + /* if(defined('e_PDO') && e_PDO === false) // TODO + { + self::$_known_handlers['db'] = '{e_HANDLER}mysql_class.php'; + }*/ // FIXME registered shutdown functions not executed after the $page output in footer - investigate // Currently manually called in front-end/admin footer //register_shutdown_function(array($this, 'destruct')); @@ -2770,8 +2774,9 @@ class e107 $override_path = $override ? $curTheme.'templates/'.$id.'_template.php' : null; $legacy_override_path = $override ? $curTheme.$id.'_template.php' : null; - $legacy_core_path = e_THEME.'templates/'.$id.'_template.php'; - $core_path = e_CORE.'templates/'.$id.'_template.php'; + $core_path = e_CORE.'templates/'.$id.'_template.php'; // default + $core_path_legacy = e_CORE.'templates/legacy/'.$id.'_template.php'; + $core_path_bs4 = e_CORE.'templates/bootstrap4/'.$id.'_template.php'; if($override_path && is_readable($override_path)) // v2 override template. { @@ -2781,10 +2786,14 @@ class e107 { return $legacy_override_path; } - elseif(is_readable($legacy_core_path)) //v1 core template. + elseif(THEME_LEGACY === true && is_readable($core_path_legacy)) //v1 core template. { - // return $legacy_core_path; // just asking for trouble. + return $core_path_legacy; } + elseif(defset('BOOTSTRAP') === 4 && is_readable($core_path_bs4)) + { + return $core_path_bs4; + } return $core_path; } diff --git a/user.php b/user.php index ee3f22e49..ded29c37b 100644 --- a/user.php +++ b/user.php @@ -105,20 +105,23 @@ $qs = explode(".", e_QUERY); $self_page =($qs[0] == 'id' && intval($qs[1]) == USERID); -$USER_TEMPLATE = e107::getCoreTemplate('user'); -e107::scStyle($sc_style); -if(empty($USER_TEMPLATE)) // BC Fix for loading old templates. +if(THEME_LEGACY === true) // v1.x BC Fix for loading old templates. { - e107::getMessage()->addDebug( "Using v1.x user template"); + $sc_style = array(); + e107::getMessage()->addDebug( "Loading v1.x user template"); include(e107::coreTemplatePath('user')); //correct way to load a core template. (don't use 'include_once' in case it has already been loaded). + e107::scStyle($sc_style); } -else +else // v2.x { + e107::getMessage()->addDebug( "Loading v2.x user template"); + $USER_TEMPLATE = e107::getCoreTemplate('user'); $USER_FULL_TEMPLATE = $USER_TEMPLATE['view']; $USER_SHORT_TEMPLATE_START = $USER_TEMPLATE['list']['start'] ; $USER_SHORT_TEMPLATE = $USER_TEMPLATE['list']['item'] ; $USER_SHORT_TEMPLATE_END = $USER_TEMPLATE['list']['end']; + } $USER_FULL_TEMPLATE = str_replace('{USER_EMBED_USERPROFILE}','{USER_ADDONS}', $USER_FULL_TEMPLATE); // BC Fix @@ -127,19 +130,6 @@ $user_shortcodes = e107::getScBatch('user'); $user_shortcodes->wrapper('user/view'); - - -/* -if (file_exists(THEME."user_template.php")) -{ - require_once(THEME."user_template.php"); -} -else -{ - require_once(e_BASE.$THEMES_DIRECTORY."templates/user_template.php"); -} - */ - $user_frm = new form; require_once(HEADERF); if (!defined("USER_WIDTH")){ define("USER_WIDTH","width:95%"); } @@ -223,17 +213,17 @@ if (isset($id)) if (isset($_POST['commentsubmit']) && $pref['profile_comments']) { $cobj = new comment; - $cobj->enter_comment($_POST['author_name'], $_POST['comment'], 'profile', $id, $pid, $_POST['subject']); + $cobj->enter_comment($_POST['author_name'], $_POST['comment'], 'profile', $id, null, $_POST['subject']); } if($text = renderuser($id)) { - $ns->tablerender(LAN_USER_50, $text); + $ns->tablerender(LAN_USER_50, e107::getMessage()->render(). $text); } else { $text = "
".LAN_USER_51."
"; - $ns->tablerender(LAN_ERROR, $text); + $ns->tablerender(LAN_ERROR, e107::getMessage()->render().$text); } unset($text); require_once(FOOTERF); @@ -326,4 +316,4 @@ function renderuser($uid, $mode = "verbose") } require_once(FOOTERF); -?> +