From 92446a5367704d3859ae85f0618b4b26be9c4606 Mon Sep 17 00:00:00 2001 From: Pascal Corpet Date: Mon, 16 Jun 2008 00:01:57 +0200 Subject: [PATCH] networking: adds a filter number for ICQ, adds a gpg icon --- htdocs/images/networking/gpg.png | Bin 0 -> 797 bytes modules/profile/general.inc.php | 4 ++++ modules/profile/page.inc.php | 17 +++++++++++++++++ upgrade/fusionax-0.0.1/02_networking.sql | 2 +- 4 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 htdocs/images/networking/gpg.png diff --git a/htdocs/images/networking/gpg.png b/htdocs/images/networking/gpg.png new file mode 100644 index 0000000000000000000000000000000000000000..97a6498b8724dabfd8aa8cc0fce9bf4b022d2b12 GIT binary patch literal 797 zcmV+&1LFLNP)Px#24YJ`L;(K){{a7>y{D4^00PBHL_t(2&jrCtXcK7w2k`&*%{MbiCP|YtP3=^T zrZrmYbGKDlTP!Gw;N#-Siw6-z@gjHJ}4lgwnkhrb^|W(r7#fpgu-L`VL7tR#Ic8iaN5wSH=L{C=^6D7&e&q+YfpBi4>d1`ik zCGcsf^i0|t-U=$CtoHSY7LI4k&tERPJF_3KhE5UOc5T~v|5qqz4SuUPfA>aroWb2% z8S8Wn!(`O@d*(i6EaB?L4ZpGK3Nr?lZU2>TFY>nI?d=<9C;ln(Rv4P=3-fyFrHm&h zSYzdANG|_c-MA@26O33wQAU*FVCHgHz6w?Xw7P)yg9|-G%LEeXxV0Gpn2Zym1f@z5 z06L}3BfZdA905hp+7b?!dYcd>p+Eottldx}J~IuHW5Gz`62 zak2 literal 0 HcmV?d00001 diff --git a/modules/profile/general.inc.php b/modules/profile/general.inc.php index 066eac6..5aa0f4b 100644 --- a/modules/profile/general.inc.php +++ b/modules/profile/general.inc.php @@ -112,12 +112,14 @@ class ProfileNetworking implements ProfileSetting private $email; private $pub; private $web; + private $number; public function __construct() { $this->email = new ProfileEmail(); $this->pub = new ProfilePub(); $this->web = new ProfileWeb(); + $this->number = new ProfileNumber(); } public function value(ProfilePage &$page, $field, $value, &$success) @@ -154,6 +156,8 @@ class ProfileNetworking implements ProfileSetting $network['address'] = $this->web->value($page, 'address', $network['address'], $s); } elseif ($filters[$network['type']] == 'email') { $network['address'] = $this->email->value($page, 'address', $network['address'], $s); + } elseif ($filters[$network['type']] == 'number') { + $network['address'] = $this->number->value($page, 'address', $network['address'], $s); } if (!$s) { $success = false; diff --git a/modules/profile/page.inc.php b/modules/profile/page.inc.php index 139178e..4b4df1d 100644 --- a/modules/profile/page.inc.php +++ b/modules/profile/page.inc.php @@ -79,6 +79,23 @@ class ProfileEmail extends ProfileNoSave } } +class ProfileNumber extends ProfileNoSave +{ + public function value(ProfilePage &$page, $field, $value, &$success) + { + if (is_null($value)) { + return isset($page->values[$field]) ? $page->values[$field] : S::v($field); + } + $value = trim($value); + $success = empty($value) || is_numeric($value); + if (!$success) { + global $page; + $page->trigError('Numéro invalide'); + } + return $value; + } +} + class ProfileTel extends ProfileNoSave { diff --git a/upgrade/fusionax-0.0.1/02_networking.sql b/upgrade/fusionax-0.0.1/02_networking.sql index 0da8e66..a266038 100644 --- a/upgrade/fusionax-0.0.1/02_networking.sql +++ b/upgrade/fusionax-0.0.1/02_networking.sql @@ -2,7 +2,7 @@ CREATE TABLE IF NOT EXISTS `profile_networking_enum` ( `network_type` tinyint unsigned NOT NULL, `name` varchar(30) NOT NULL, `icon` varchar(50) NOT NULL COMMENT 'icon filename', - `filter` enum('email','web','none') NOT NULL DEFAULT 'none' COMMENT 'filter type for addresses', + `filter` enum('email','web','number','none') NOT NULL DEFAULT 'none' COMMENT 'filter type for addresses', PRIMARY KEY (`network_type`) ) CHARSET=utf8 COMMENT='types of networking addresses'; -- 2.1.4