1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-25 17:01:43 +02:00

Issue #4146 - Fixed user profile navigation (next/prev) for legacy, bootstrap3 and bootstrap4 themes.

Closes #4021 - Added support for independent core templates for legacy, bootstrap3 and bootstrap4 templates.
This commit is contained in:
Cameron
2020-05-08 14:34:34 -07:00
parent 0f2ab37d47
commit 8c254bccd6
7 changed files with 433 additions and 54 deletions

View File

@@ -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");

View File

@@ -0,0 +1,163 @@
<?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_themes/templates/user_template.php,v $
* $Revision$
* $Date$
* $Author$
*/
if (!defined('e107_INIT')) { exit; }
// Bootstrap 4 v2.x Standards.
$USER_TEMPLATE = array(); // reset the legacy template above.
$USER_WRAPPER = array(); // reset all the legacy wrappers above.
$USER_TEMPLATE['addon'] = '
<div class="row">
<div class="col-xs-12 col-md-4">{USER_ADDON_LABEL}</div>
<div class="col-xs-12 col-md-8">{USER_ADDON_TEXT}</div>
</div>
';
$USER_TEMPLATE['extended']['start'] = '';
$USER_TEMPLATE['extended']['end'] = '';
$USER_TEMPLATE['extended']['item'] = '
<div class="row {EXTENDED_ID}">
<div class="ue-label col-xs-12 col-md-4">{EXTENDED_NAME}</div>
<div class="ue-value col-xs-12 col-md-8">{EXTENDED_VALUE}</div>
</div>
';
$USER_TEMPLATE['list']['start'] = "
<div class='content user-list'>
<div class='center'>".LAN_USER_56." {TOTAL_USERS}
<br />
<br />
{USER_FORM_START}
<div class='form-inline'>
".LAN_SHOW.": {USER_FORM_RECORDS} ".LAN_USER_57." {USER_FORM_ORDER}
{USER_FORM_SUBMIT}
</div>
{USER_FORM_END}
</div>
<br />
<br />
<table style='".USER_WIDTH."' class='table fborder e-list'>
<thead>
<tr>
<th class='fcaption' style='width:2%'>&nbsp;</th>
<th class='fcaption' style='width:20%'>".LAN_USER_58."</th>
<th class='fcaption' style='width:20%'>".LAN_USER_60."</th>
<th class='fcaption' style='width:20%'>".LAN_USER_59."</th>
</tr>
</thead>
<tbody>
{SETIMAGE: w=40}
";
$USER_TEMPLATE['list']['item'] = "
<tr>
<td class='forumheader3' style='width:2%'>{USER_PICTURE}</td>
<td class='forumheader3' style='width:20%'>{USER_ID}: {USER_NAME_LINK}</td>
<td class='forumheader3' style='width:20%'>{USER_EMAIL}</td>
<td class='forumheader3' style='width:20%'>{USER_JOIN}</td>
</tr>
";
$USER_TEMPLATE['list']['end'] = "
</tbody>
</table>
</div>
";
// View shortcode wrappers.
$USER_WRAPPER['view']['USER_COMMENTPOSTS'] = '<div class="col-xs-12 col-md-4">'.LAN_USER_68.'</div><div class="col-xs-12 col-md-8">{---}';
$USER_WRAPPER['view']['USER_COMMENTPER'] = ' ( {---}% )</div>';
$USER_WRAPPER['view']['USER_SIGNATURE'] = '<div>{---}</div>';
$USER_WRAPPER['view']['USER_RATING'] = '<div>{---}</div>';
$USER_WRAPPER['view']['USER_SENDPM'] = '<div>{---}</div>';
$USER_WRAPPER['view']['PROFILE_COMMENTS'] = '<div class="clearfix">{---}</div>';
// $USER_WRAPPER['view']['PROFILE_COMMENT_FORM'] = '{---} </div>';
$USER_TEMPLATE['view'] = '
{SETIMAGE: w=600}
<div class="user-profile user-profile-bs4 row">
<div class="col-md-12">
<div class="panel panel-default panel-profile clearfix">
<div class="panel-heading" style="height:180px; background-size: cover;background-image: url( {USER_PHOTO: type=url});">
<h5 class="user-id">'.LAN_USER_58.' {USER_ID}</h5>
</div>
<div class="panel-body text-center">
{SETIMAGE: w=200&h=200&crop=1}
{USER_PICTURE: shape=circle&link=1}
<div class="profile-header">
<h4>{USER_NAME}</h4>
{USER_SIGNATURE}
{USER_RATING}
{USER_SENDPM}
</div>
</div>
<div class="panel-body">
<div class="row"><div class="col-xs-12 col-md-4">'.LAN_USER_63.'</div><div class="col-xs-12 col-md-8">{USER_REALNAME}</div></div>
<div class="row"><div class="col-xs-12 col-md-4">'.LAN_USER_02.'</div><div class="col-xs-12 col-md-8">{USER_LOGINNAME}</div></div>
<div class="row"><div class="col-xs-12 col-md-4">'.LAN_USER_60.'</div><div class="col-xs-12 col-md-8">{USER_EMAIL}</div></div>
<div class="row"><div class="col-xs-12 col-md-4">'.LAN_USER_54.'</div><div class="col-xs-12 col-md-8">{USER_LEVEL}</div></div>
<div class="row"><div class="col-xs-12 col-md-4">'.LAN_USER_65.'</div><div class="col-xs-12 col-md-8">{USER_LASTVISIT}<br /><small class="padding-left">{USER_LASTVISIT_LAPSE}</small></div></div>
<div class="row"><div class="col-xs-12 col-md-4">'.LAN_USER_59.'</div><div class="col-xs-12 col-md-8">{USER_JOIN}<br /><small class="padding-left">{USER_DAYSREGGED}</small></div></div>
<div class="row"><div class="col-xs-12 col-md-4">'.LAN_USER_66.'</div><div class="col-xs-12 col-md-8">{USER_VISITS}</div></div>
{USER_ADDONS}
<div class="row">{USER_COMMENTPOSTS} {USER_COMMENTPER}</div>
{USER_EXTENDED_ALL}
<div class="row"></div>
</div>
<div class="panel-body text-center">
{USER_UPDATE_LINK}
</div>
<div class="panel-body">
<ul class="pagination user-view-nextprev">
<li class="page-item previous">
{USER_JUMP_LINK=prev}
</li>
<li>
<!-- Back to List? -->
</li>
<li class="page-item next">
{USER_JUMP_LINK=next}
</li>
</ul>
</div>
</div>
</div>
</div>
<!-- Start Comments -->
{PROFILE_COMMENTS}
<!-- End Comments -->
';

View File

@@ -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),
);

View File

@@ -0,0 +1,220 @@
<?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_themes/templates/user_template.php,v $
* $Revision$
* $Date$
* $Author$
*/
if (!defined('e107_INIT')) { exit; }
if (!defined("USER_WIDTH"))
{
define("USER_WIDTH", "width:95%");
}
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);
/// --------------------- Start of Legacy Code --------------------------------------- //
$EXTENDED_CATEGORY_START = "<tr><td colspan='2' class='forumheader center'>{EXTENDED_NAME}</td></tr>";
$EXTENDED_CATEGORY_TABLE = "
<tr>
<td style='width:30%' class='forumheader3'>{EXTENDED_ICON}{EXTENDED_NAME}
</td>
<td style='width:70%' class='forumheader3'>{EXTENDED_VALUE}</td>
</tr>
";
$EXTENDED_CATEGORY_END = "";
/**
* Preparing for huge markup/css changes
*/
$USER_SHORT_TEMPLATE_START = "
<div class='content user-list'>
<div class='center'>".LAN_USER_56." {TOTAL_USERS}
<br />
<br />
{USER_FORM_START}
<div class='form-inline'>
".LAN_SHOW.": {USER_FORM_RECORDS} ".LAN_USER_57." {USER_FORM_ORDER}
{USER_FORM_SUBMIT}
</div>
{USER_FORM_END}
</div>
<br />
<br />
<table style='".USER_WIDTH."' class='table fborder e-list'>
<thead>
<tr>
<th class='fcaption' style='width:2%'>&nbsp;</th>
<th class='fcaption' style='width:20%'>".LAN_USER_58."</th>
<th class='fcaption' style='width:20%'>".LAN_USER_60."</th>
<th class='fcaption' style='width:20%'>".LAN_USER_59."</th>
</tr>
</thead>
<tbody>
{SETIMAGE: w=40}
";
$USER_SHORT_TEMPLATE_END = "
</tbody>
</table>
</div>
";
$USER_SHORT_TEMPLATE = "
<tr>
<td class='forumheader3' style='width:2%'>{USER_PICTURE}</td>
<td class='forumheader3' style='width:20%'>{USER_ID}: {USER_NAME_LINK}</td>
<td class='forumheader3' style='width:20%'>{USER_EMAIL}</td>
<td class='forumheader3' style='width:20%'>{USER_JOIN}</td>
</tr>
";
$sc_style['USER_SIGNATURE']['pre'] = "<tr><td colspan='2' class='forumheader3 left'>";
$sc_style['USER_SIGNATURE']['post'] = "</td></tr>";
$sc_style['USER_COMMENTS_LINK']['pre'] = "<tr><td colspan='2' class='forumheader3 left'>";
$sc_style['USER_COMMENTS_LINK']['post'] = "</td></tr>";
$sc_style['USER_FORUM_LINK']['pre'] = "<tr><td colspan='2' class='forumheader3 left'>";
$sc_style['USER_FORUM_LINK']['post'] = "</td></tr>";
$sc_style['USER_UPDATE_LINK']['pre'] = "<tr><td colspan='2' class='forumheader3 center'>";
$sc_style['USER_UPDATE_LINK']['post'] = "</td></tr>";
$sc_style['USER_RATING']['pre'] = "<tr><td colspan='2' class='forumheader3'><div class='f-left'>".LAN_RATING."</div><div class='f-right'>";
$sc_style['USER_RATING']['post'] = "</div></td></tr>";
$sc_style['USER_LOGINNAME']['pre'] = " : ";
$sc_style['USER_COMMENTPOSTS']['pre'] = "<tr><td style='width:30%' class='forumheader3'>".LAN_USER_68."</td><td style='width:70%' class='forumheader3'>";
$sc_style['USER_COMMENTPOSTS']['post'] = "";
$sc_style['USER_COMMENTPER']['pre'] = " ( ";
$sc_style['USER_COMMENTPER']['post'] = "% )</td></tr>";
//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'] = "<tr><td colspan='2' class='forumheader3'><div class='f-left'>";
$sc_style['USER_SENDPM']['post'] = "</div><div class='f-right'>".LAN_USER_62."</div></td></tr>";
// 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']="<td {$span} class='forumheader3 center middle' style='width:20%'>";
//$sc_style['USER_PICTURE']['post']="</td>";
$USER_FULL_TEMPLATE = "{SETIMAGE: w=250}
<div class='content user user-legacy'>
<table style='".USER_WIDTH."' class='table fborder'>
<tr>
<td colspan='2' class='fcaption center'>".LAN_USER_58." {USER_ID} : {USER_NAME}{USER_LOGINNAME}</td>
</tr>
<tr>
<td {$span} class='forumheader3 center middle' style='width:20%'>{USER_PICTURE}</td>
<td {$main_colspan} class='forumheader3'>
<div class='f-left'>{USER_ICON=realname} ".LAN_USER_63."</div>
<div class='f-right right'>{USER_REALNAME}</div>
</td>
</tr>
<tr>
<td {$main_colspan} class='forumheader3'>
<div class='f-left'>{USER_ICON=email} ".LAN_USER_60."</div>
<div class='f-right right'>{USER_EMAIL}</div>
</td>
</tr>
<tr>
<td {$main_colspan} class='forumheader3'>
<div class='f-left'>{USER_ICON=level} ".LAN_USER_54.":</div>
<div class='f-right right'>{USER_LEVEL}</div>
</td>
</tr>
<tr>
<td {$main_colspan} class='forumheader3'>
<div class='f-left'>{USER_ICON=lastvisit} ".LAN_USER_65.":&nbsp;&nbsp;</div>
<div class='f-right right'>{USER_LASTVISIT}<br />{USER_LASTVISIT_LAPSE}</div>
</td>
</tr>
{USER_SENDPM}
{USER_RATING}
{USER_SIGNATURE}
{USER_EXTENDED_ALL}
<tr>
<td colspan='2' class='forumheader'>".LAN_USER_64."</td>
</tr>
<tr>
<td style='width:30%' class='forumheader3'>".LAN_USER_59."</td>
<td style='width:70%' class='forumheader3'>{USER_JOIN}<br />{USER_DAYSREGGED}</td>
</tr>
<tr>
<td style='width:30%' class='forumheader3'>".LAN_USER_66."</td>
<td style='width:70%' class='forumheader3'>{USER_VISITS}</td>
</tr>
{USER_ADDONS}
{USER_COMMENTPOSTS}
{USER_COMMENTPER}
{USER_UPDATE_LINK}
<tr>
<td colspan='2' class='forumheader3' style='text-align:center'>
<table style='width:95%'>
<tr>
<td style='width:50%'>{USER_JUMP_LINK=prev}</td>
<td style='width:50%; text-align:right'>{USER_JUMP_LINK=next}</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
{PROFILE_COMMENTS}
{PROFILE_COMMENT_FORM}
";
$USER_EMBED_USERPROFILE_TEMPLATE = "
<tr>
<td class='forumheader3'>{USER_ADDON_LABEL}</td>
<td class='forumheader3'>{USER_ADDON_TEXT}</td>
</tr>";

View File

@@ -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 = "
<div class='content user-list'>
<div class='center'>".LAN_USER_56." {TOTAL_USERS}
@@ -109,7 +106,7 @@ $sc_style['USER_COMMENTPOSTS']['post'] = "";
$sc_style['USER_COMMENTPER']['pre'] = " ( ";
$sc_style['USER_COMMENTPER']['post'] = "% )</td></tr>";
//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'))
<!-- End Comments -->
';
}
@@ -392,7 +387,3 @@ if(deftrue('BOOTSTRAP'))
?>

View File

@@ -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;
}

View File

@@ -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 = "<div style='text-align:center'>".LAN_USER_51."</div>";
$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);
?>