mirror of
https://github.com/e107inc/e107.git
synced 2025-06-03 17:34:59 +02:00
new feature: e_userprofile : embed plugin data into the user profile page
This commit is contained in:
parent
eba031ef6e
commit
fe612a157a
@ -11,9 +11,9 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_files/shortcode/batch/user_shortcodes.php,v $
|
||||
| $Revision: 1.2 $
|
||||
| $Date: 2006-12-07 15:41:50 $
|
||||
| $Author: sweetas $
|
||||
| $Revision: 1.3 $
|
||||
| $Date: 2007-03-27 13:48:30 $
|
||||
| $Author: lisa_ $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
if (!defined('e107_INIT')) { exit; }
|
||||
@ -550,6 +550,83 @@ SC_BEGIN USER_FORM_SUBMIT
|
||||
return "<input class='button' type='submit' name='submit' value='".LAN_422."' />";
|
||||
SC_END
|
||||
|
||||
SC_BEGIN USER_EMBED_USERPROFILE
|
||||
global $pref, $USER_EMBED_USERPROFILE_TEMPLATE, $embed_already_rendered;
|
||||
|
||||
//if no parm, it means we render ALL embedded contents
|
||||
//so we're preloading all registerd e_userprofile files
|
||||
$key = varset($pref['e_userprofile_list']);
|
||||
|
||||
//if we don't have any embedded contents, return
|
||||
if(!is_array($key) || empty($key)){ return; }
|
||||
|
||||
//array holding specific hooks to render
|
||||
$render=array();
|
||||
|
||||
if($parm){
|
||||
|
||||
//if the first char of parm is an ! mark, it means it should not render the following parms
|
||||
if(strpos($parm,'!')===0){
|
||||
$tmp = explode(",", substr($parm,1) );
|
||||
foreach($tmp as $not){
|
||||
$not=trim($not);
|
||||
if(isset($key[$not])){
|
||||
//so we're unsetting them from the $key array
|
||||
unset($key[$not]);
|
||||
}
|
||||
}
|
||||
|
||||
//else it means we render only the following parms
|
||||
}else{
|
||||
$tmp = explode(",", $parm );
|
||||
foreach($tmp as $yes){
|
||||
$yes=trim($yes);
|
||||
if(isset($key[$yes])){
|
||||
//so add the ones we need to render to the $render array
|
||||
$render[$yes] = $key[$yes];
|
||||
}
|
||||
}
|
||||
//finally assign the render array as the key array, overwriting it
|
||||
$key = $render;
|
||||
}
|
||||
}
|
||||
|
||||
foreach($key as $hook){
|
||||
//include the e_user file and initiate the class
|
||||
if(is_readable(e_PLUGIN.$hook."/e_userprofile.php")){
|
||||
//if the current hook is not yet rendered
|
||||
if(!in_array($hook, $embed_already_rendered)){
|
||||
require_once(e_PLUGIN.$hook."/e_userprofile.php");
|
||||
$name = "e_userprofile_{$hook}";
|
||||
if(function_exists($name)){
|
||||
$arr[] = $name();
|
||||
//we need to store which hooks are already rendered
|
||||
$embed_already_rendered[] = $hook;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$ret = '';
|
||||
foreach($arr as $data){
|
||||
if(is_array($data['caption'])){
|
||||
foreach($data['caption'] as $k=>$v){
|
||||
if(isset($data['caption'][$k]) && isset($data['text'][$k])){
|
||||
$search = array('{USER_EMBED_USERPROFILE_CAPTION}', '{USER_EMBED_USERPROFILE_TEXT}');
|
||||
$replace = array($data['caption'][$k], $data['text'][$k]);
|
||||
$ret .= str_replace($search, $replace, $USER_EMBED_USERPROFILE_TEMPLATE);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
if(isset($data['caption']) && isset($data['text'])){
|
||||
$search = array('{USER_EMBED_USERPROFILE_CAPTION}', '{USER_EMBED_USERPROFILE_TEXT}');
|
||||
$replace = array($data['caption'], $data['text']);
|
||||
$ret .= str_replace($search, $replace, $USER_EMBED_USERPROFILE_TEMPLATE);
|
||||
}
|
||||
}
|
||||
}
|
||||
return $ret;
|
||||
SC_END
|
||||
|
||||
*/
|
||||
?>
|
||||
?>
|
@ -11,9 +11,9 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_handlers/plugin_class.php,v $
|
||||
| $Revision: 1.5 $
|
||||
| $Date: 2007-02-14 21:17:03 $
|
||||
| $Author: e107steved $
|
||||
| $Revision: 1.6 $
|
||||
| $Date: 2007-03-27 13:48:30 $
|
||||
| $Author: lisa_ $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
@ -21,7 +21,7 @@ if (!defined('e107_INIT')) { exit; }
|
||||
|
||||
class e107plugin
|
||||
{
|
||||
var $plugin_addons = array("e_rss", "e_notify", "e_linkgen", "e_list", "e_bb", "e_meta", "e_emailprint", "e_frontpage", "e_latest", "e_status", "e_search", "e_sc", "e_module", "e_comment", "e_sql");
|
||||
var $plugin_addons = array("e_rss", "e_notify", "e_linkgen", "e_list", "e_bb", "e_meta", "e_emailprint", "e_frontpage", "e_latest", "e_status", "e_search", "e_sc", "e_module", "e_comment", "e_sql", "e_userprofile");
|
||||
|
||||
// List of all plugin variables which need to be checked - install required if one or more set and non-empty
|
||||
var $all_eplug_install_variables = array(
|
||||
|
89
e107_plugins/content/e_userprofile.php
Normal file
89
e107_plugins/content/e_userprofile.php
Normal file
@ -0,0 +1,89 @@
|
||||
<?php
|
||||
|
||||
if(!function_exists('e_userprofile_content')){
|
||||
function e_userprofile_content(){
|
||||
global $qs, $sql, $tp;
|
||||
|
||||
include_lan(e_PLUGIN."content/languages/".e_LANGUAGE."/lan_content.php");
|
||||
require_once(e_PLUGIN.'content/handlers/content_class.php');
|
||||
$aa = new content;
|
||||
|
||||
$userid=intval($qs[1]);
|
||||
|
||||
$caption = array();
|
||||
$data = array();
|
||||
|
||||
//get main parent types
|
||||
$sqlm = new db;
|
||||
if($sqlm -> db_Select("pcontent", "*", "content_class REGEXP '".e_CLASS_REGEXP."' AND content_parent = '0' ".$datequery." ".$headingquery." ORDER BY content_heading")){
|
||||
while($rowm = $sqlm -> db_Fetch()){
|
||||
//global var for this main parent
|
||||
$mainparent = $rowm['content_id'];
|
||||
$maincaption = $rowm['content_heading'];
|
||||
|
||||
$text = '';
|
||||
|
||||
//prepare query paramaters
|
||||
$array = $aa -> getCategoryTree("", $mainparent, TRUE);
|
||||
$validparent = implode(",", array_keys($array));
|
||||
$qry = " p.content_parent REGEXP '".$aa -> CONTENTREGEXP($validparent)."' ";
|
||||
$datequery = " AND p.content_datestamp < ".time()." AND (p.content_enddate=0 || p.content_enddate>".time().") ";
|
||||
$content_pref = $aa -> getContentPref($mainparent);
|
||||
$content_icon_path = $tp -> replaceConstants($content_pref["content_icon_path"]);
|
||||
$l = strlen($userid)+1;
|
||||
$userquery = " AND (p.content_author = '".$userid."' || LEFT(p.content_author, ".$l.") = '".$userid."^' OR SUBSTRING_INDEX(p.content_author, '^', 1) = '".$userid."' ) ";
|
||||
|
||||
$qry = "
|
||||
SELECT p.content_id, p.content_heading, p.content_subheading, p.content_icon, p.content_datestamp
|
||||
FROM #pcontent AS p
|
||||
WHERE LEFT(p.content_parent,1) != '0'
|
||||
AND ".$qry." ".$datequery."
|
||||
AND p.content_class REGEXP '".e_CLASS_REGEXP."'
|
||||
".$userquery."
|
||||
ORDER BY p.content_heading ";
|
||||
$qry1 = $qry." LIMIT 0,3";
|
||||
|
||||
$found=false;
|
||||
$sqlc = new db;
|
||||
$total = $sqlc -> db_Select_gen($qry);
|
||||
if($sqlc -> db_Select_gen($qry1)){
|
||||
|
||||
while($rowc = $sqlc -> db_Fetch()){
|
||||
|
||||
$icon='';
|
||||
if($rowc['content_icon'] && is_readable($content_icon_path.$rowc['content_icon'])){
|
||||
$icon = "<a href='".e_PLUGIN."content/content.php?content.".$rowc['content_id']."' ><img src='".$content_icon_path.$rowc['content_icon']."' style='width:50px; height:50px;' alt='' /></a>";
|
||||
}else{
|
||||
$icon = "<a href='".e_PLUGIN."content/content.php?content.".$rowc['content_id']."' ><img src='".$content_icon_path."blank.gif' style='width:50px; height:50px;' alt='' /></a>";
|
||||
}
|
||||
|
||||
$date = strftime("%d %b %Y", $rowc['content_datestamp']);
|
||||
$subheading = ($row['content_subheading'] ? $row['content_subheading']."<br />" : '');
|
||||
|
||||
$text .= "
|
||||
<div style='clear:both; padding-bottom:10px;'>
|
||||
<div style='float:left; padding-bottom:10px;'>".$icon."</div>
|
||||
<div style='margin-left:60px; padding-bottom:10px;'>
|
||||
<a href='".e_PLUGIN."content/content.php?content.".$rowc['content_id']."'>".$tp->toHTML($rowc['content_heading'], TRUE, "")."</a><br />
|
||||
".$subheading."
|
||||
<span class='smalltext'>".$date."</span>
|
||||
</div>
|
||||
</div>";
|
||||
|
||||
$id = $rowc['content_id'];
|
||||
$found=true;
|
||||
}
|
||||
$lan0 = str_replace('{caption}',$maincaption, CONTENT_USERPROFILE_LAN_1);
|
||||
$text .= "<div style='clear:both; padding-bottom:10px;'><a href='".e_PLUGIN."content/content.php?author.".$id."'>".$lan0."</a></div>";
|
||||
}
|
||||
if($found){
|
||||
$caption[] = str_replace(array('{caption}','{total}'),array($maincaption, $total), CONTENT_USERPROFILE_LAN_2);
|
||||
$data[] = $text;
|
||||
}
|
||||
}
|
||||
return array('caption'=>$caption, 'text'=>$data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -4,8 +4,8 @@
|
||||
| e107 website system - Language File.
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_plugins/content/languages/English/lan_content.php,v $
|
||||
| $Revision: 1.3 $
|
||||
| $Date: 2007-03-13 16:51:05 $
|
||||
| $Revision: 1.4 $
|
||||
| $Date: 2007-03-27 13:48:30 $
|
||||
| $Author: lisa_ $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
@ -15,6 +15,9 @@ define("CONTENT_EMAILPRINT_LAN_1", "this content item is from");
|
||||
|
||||
define("POPUP_LAN_1", "click to enlarge image");
|
||||
|
||||
define("CONTENT_USERPROFILE_LAN_1", ">> view all content {caption} items");
|
||||
define("CONTENT_USERPROFILE_LAN_2", "content {caption}: {total} items found");
|
||||
|
||||
define("CONTENT_NOTIFY_LAN_1", "Content Events");
|
||||
define("CONTENT_NOTIFY_LAN_2", "Content item submitted by user");
|
||||
define("CONTENT_NOTIFY_LAN_3", "Content Submitted");
|
||||
|
63
e107_plugins/links_page/e_userprofile.php
Normal file
63
e107_plugins/links_page/e_userprofile.php
Normal file
@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
if(!function_exists('e_userprofile_links_page')){
|
||||
function e_userprofile_links_page(){
|
||||
global $qs, $sql, $tp;
|
||||
|
||||
$id=intval($qs[1]);
|
||||
|
||||
$qry = "
|
||||
SELECT l.*, lc.*
|
||||
FROM #links_page AS l
|
||||
LEFT JOIN #links_page_cat AS lc ON lc.link_category_id = l.link_category
|
||||
WHERE l.link_author = '".$id."'
|
||||
ORDER BY l.link_name";
|
||||
|
||||
$qry1 = $qry." LIMIT 0,3";
|
||||
|
||||
$text = '';
|
||||
|
||||
$total = $sql -> db_Select_gen($qry);
|
||||
if($sql -> db_Select_gen($qry1)){
|
||||
include_lan(e_PLUGIN."links_page/languages/".e_LANGUAGE.".php");
|
||||
while($row = $sql -> db_Fetch()){
|
||||
|
||||
$LINK_APPEND = "<a class='linkspage_url' href='".$row['link_url']."' onclick=\"open_window('".e_PLUGIN."links_page/links.php?view.".$row['link_id']."','full');return false;\" >";
|
||||
|
||||
$icon = $LINK_APPEND."<img class='linkspage_button' style='width:50px; height:50px;' src='".e_PLUGIN."links_page/images/blank.gif' alt='' /></a>";
|
||||
if ($row['link_button']) {
|
||||
if (strpos($row['link_button'], "http://") !== FALSE) {
|
||||
$icon = $LINK_APPEND."<img class='linkspage_button' src='".$row['link_button']."' alt='' /></a>";
|
||||
} else {
|
||||
if(strstr($row['link_button'], "/")){
|
||||
if(is_readable(e_BASE.$row['link_button'])){
|
||||
$icon = $LINK_APPEND."<img class='linkspage_button' style='width:50px; height:50px;' src='".e_BASE.$row['link_button']."' alt='' /></a>";
|
||||
}
|
||||
}else{
|
||||
if(is_readable(e_PLUGIN."links_page/link_images/".$row['link_button'])){
|
||||
$icon = $LINK_APPEND."<img class='linkspage_button' style='width:50px; height:50px;' src='".e_PLUGIN."links_page/link_images/".$row['link_button']."' alt='' /></a>";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$date = strftime("%d %b %Y", $row['link_datestamp']);
|
||||
$heading = ($row['link_name'] ? $LINK_APPEND.$tp->toHTML($row['link_name'], TRUE)."</a><br />" : '');
|
||||
|
||||
$text .= "
|
||||
<div style='clear:both; padding-bottom:10px;'>
|
||||
<div style='float:left; padding-bottom:10px;'>".$icon."</div>
|
||||
<div style='margin-left:60px; padding-bottom:10px;'>
|
||||
".$heading."
|
||||
<span class='smalltext'>".$date."</span>
|
||||
</div>
|
||||
</div>";
|
||||
}
|
||||
$text .= "<div style='clear:both; padding-bottom:10px;'><a href='".e_PLUGIN."links_page/links.php'>".LCLAN_USERPROFILE_1."</a></div>";
|
||||
}
|
||||
$caption = str_replace('{total}',$total, LCLAN_USERPROFILE_2);
|
||||
return array('caption'=>$caption, 'text'=>$text);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -4,15 +4,14 @@
|
||||
| e107 website system - Language File.
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_plugins/links_page/languages/English.php,v $
|
||||
| $Revision: 1.2 $
|
||||
| $Date: 2006-12-29 12:58:37 $
|
||||
| $Author: e107steved $
|
||||
| $Revision: 1.3 $
|
||||
| $Date: 2007-03-27 13:48:30 $
|
||||
| $Author: lisa_ $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
// if(!defined("PAGE_NAME")){define("PAGE_NAME", "Links");} <--
|
||||
// Lisa, could you please move this out of the language file ?
|
||||
|
||||
|
||||
define("LCLAN_USERPROFILE_1", ">> view all links");
|
||||
define("LCLAN_USERPROFILE_2", "links: {total} links found");
|
||||
|
||||
define("LCLAN_PLUGIN_LAN_1", "Links Page");
|
||||
define("LCLAN_PLUGIN_LAN_2", "Links Page For Displaying External Web Links");
|
||||
|
@ -11,9 +11,9 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_themes/templates/user_template.php,v $
|
||||
| $Revision: 1.1.1.1 $
|
||||
| $Date: 2006-12-02 04:36:13 $
|
||||
| $Author: mcfly_e107 $
|
||||
| $Revision: 1.2 $
|
||||
| $Date: 2007-03-27 13:48:30 $
|
||||
| $Author: lisa_ $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
@ -185,6 +185,7 @@ $USER_FULL_TEMPLATE = "
|
||||
<td style='width:30%' class='forumheader3'>".LAN_146."</td>
|
||||
<td style='width:70%' class='forumheader3'>{USER_VISITS}</td>
|
||||
</tr>
|
||||
{USER_EMBED_USERPROFILE}
|
||||
{USER_UPDATE_LINK}
|
||||
<tr>
|
||||
<td colspan='2' class='forumheader3' style='text-align:center'>
|
||||
@ -200,4 +201,9 @@ $USER_FULL_TEMPLATE = "
|
||||
{PROFILE_COMMENTS}
|
||||
{PROFILE_COMMENT_FORM}
|
||||
";
|
||||
|
||||
$USER_EMBED_USERPROFILE_TEMPLATE = "
|
||||
<tr><td colspan='2' class='fcaption'>{USER_EMBED_USERPROFILE_CAPTION}</td></tr>
|
||||
<tr><td colspan='2' class='forumheader3'>{USER_EMBED_USERPROFILE_TEXT}</td></tr>";
|
||||
|
||||
?>
|
Loading…
x
Reference in New Issue
Block a user