From dc6378df04a613f3a65ae5e501b65de64a672b9a Mon Sep 17 00:00:00 2001 From: Guillaume Bandet Date: Fri, 20 Jun 2008 18:37:40 +0200 Subject: [PATCH] Adds the possibility to forge an url linking to a profile page from networking addresses --- include/user.func.inc.php | 3 ++- modules/profile.php | 3 ++- templates/profile/profile.tpl | 2 ++ upgrade/fusionax-0.0.1/02_networking.sql | 1 + 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/include/user.func.inc.php b/include/user.func.inc.php index 0f8b944..0fdd3ae 100644 --- a/include/user.func.inc.php +++ b/include/user.func.inc.php @@ -499,13 +499,14 @@ function &get_user_details($login, $from_uid = '', $view = 'private') } $user['networking'] = Array(); - $res = XDB::iterator("SELECT n.address, n.pub, m.network_type AS type, m.name, m.filter + $res = XDB::iterator("SELECT n.address, n.pub, m.network_type AS type, m.name, m.filter, m.link FROM profile_networking AS n INNER JOIN profile_networking_enum AS m ON (n.network_type = m.network_type) WHERE n.uid = {?}", $uid); while($network = $res->next()) { if (has_user_right($network['pub'], $view)) { + $network['link'] = str_replace('%s', $network['address'], $network['link']); $user['networking'][] = $network; } } diff --git a/modules/profile.php b/modules/profile.php index 89a4d56..ba1a4f2 100644 --- a/modules/profile.php +++ b/modules/profile.php @@ -826,7 +826,8 @@ class ProfileModule extends PLModule $table_editor = new PLTableEditor('admin/networking', 'profile_networking_enum', 'network_type'); $table_editor->describe('name', 'intitulé', true); $table_editor->describe('icon', 'nom de l\'icône', false); - $table_editor->describe('filter', 'nom du filtre à appliquer', true); + $table_editor->describe('filter', 'filtre', true); + $table_editor->describe('link', 'lien web', true); $table_editor->apply($page, $action, $id); } function handler_admin_phones_format_display(&$page, $action = 'list', $id = null) { diff --git a/templates/profile/profile.tpl b/templates/profile/profile.tpl index 9ddee57..a9fd049 100644 --- a/templates/profile/profile.tpl +++ b/templates/profile/profile.tpl @@ -56,6 +56,8 @@ function chgMainWinLoc(strPage) {$network.name} {if $network.filter == 'web'} {$network.address} + {elseif $network.link != ''} + {$network.address} {else} {$network.address} {/if} diff --git a/upgrade/fusionax-0.0.1/02_networking.sql b/upgrade/fusionax-0.0.1/02_networking.sql index 64cbc8f..17172c9 100644 --- a/upgrade/fusionax-0.0.1/02_networking.sql +++ b/upgrade/fusionax-0.0.1/02_networking.sql @@ -3,6 +3,7 @@ CREATE TABLE IF NOT EXISTS `profile_networking_enum` ( `name` varchar(30) NOT NULL, `icon` varchar(50) NOT NULL COMMENT 'icon filename', `filter` enum('email','web','number','none') NOT NULL DEFAULT 'none' COMMENT 'filter type for addresses', + `link` varchar(255) NOT NULL COMMENT 'string used to forge an URL linking to the the profile page', PRIMARY KEY (`network_type`) ) CHARSET=utf8 COMMENT='types of networking addresses'; -- 2.1.4