This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "FusionForge".

The branch, master has been updated
       via  e6a61d4c94175f113835e80818286f55d00ae753 (commit)
      from  52e1d7761e5fcc6556d71fc1f9ac1aa7d18ac552 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=e6a61d4c94175f113835e80818286f55d00ae753

commit e6a61d4c94175f113835e80818286f55d00ae753
Author: Marc-Etienne Vargenau <[email protected]>
Date:   Thu Jun 30 17:59:50 2016 +0200

    New functions: isEditable(), isHidden(), setUneditable(), setHidden()

diff --git a/src/common/include/User.class.php 
b/src/common/include/User.class.php
index cc778d3..73cc8e9 100644
--- a/src/common/include/User.class.php
+++ b/src/common/include/User.class.php
@@ -522,7 +522,6 @@ Use one below, but make sure it is entered as the single 
line.)
                                }
                        }
 
-
                        db_begin();
                        $monitorElementsArray = array('artifact', 
'artifact_type', 'docdata', 'docgroup', 'forum');
                        foreach ($monitorElementsArray as $monitorElement) {
@@ -1717,6 +1716,99 @@ Email: %3$s
                }
                return true;
        }
+
+       /**
+        *    isEditable - verify if field name is editable
+        *
+        * @param string $fieldName Field name
+        * @return    boolean
+        */
+       function isEditable($fieldName) {
+               if (!isset($this->data_array['uneditable'])) {
+                       $flag = true;
+               } else {
+                       $uneditable = 
unserialize($this->data_array['uneditable']);
+                       if (is_array($uneditable) && in_array($fieldName, 
$uneditable)) {
+                               $flag = false;
+                       } else {
+                               $flag = true;
+                       }
+               }
+
+               if ($this->refresh) {
+                       $flag = !$flag;
+               }
+
+               return $flag;
+       }
+
+       /**
+        * isHidden - verify if field name is hidden
+        *
+        * @param string $fieldName Field name
+        * @return    boolean
+        */
+       function isHidden($fieldName) {
+               if (!isset($this->data_array['hidden']))
+                       return false;
+
+               $hidden = unserialize($this->data_array['hidden']);
+               if (is_array($hidden) && in_array($fieldName, $hidden)) {
+                       return true;
+               } else {
+                       return false;
+               }
+       }
+
+       /**
+        * setUneditable - set the list of uneditable fields of this user.
+        *
+        * @param    array $data        array of uneditable field names
+        * @return    boolean.
+        */
+       function setUneditable($data) {
+               if (!is_array($data)) {
+                       $this->setError('Error: Cannot Update list of 
uneditable fields: not an array');
+                       return false;
+               }
+
+               $serializedData = serialize($data);
+               $sql = "UPDATE users
+                               SET uneditable='".$serializedData."'
+                               WHERE user_id='".$this->getID()."'";
+               $res = db_query($sql);
+               if (!$res || db_affected_rows($res) < 1) {
+                       $this->setError('Error: Cannot Update list of 
uneditable fields: '.db_error());
+                       return false;
+               }
+               $this->data_array['uneditable'] = $serializedData;
+               return true;
+       }
+
+       /**
+        * setHidden - set the list of hidden fields of this user.
+        *
+        * @param array $data Array of hidden field names
+        * @return    boolean.
+        */
+       function setHidden($data) {
+               if (!is_array($data)) {
+                       $this->setError('Error: Cannot Update list of hidden 
fields: not an array');
+                       return false;
+               }
+
+               $serializedData = serialize($data);
+               $sql = "UPDATE users
+                               SET hidden='".$serializedData."'
+                               WHERE user_id='".$this->getID()."'";
+               $res = db_query($sql);
+               if (!$res || db_affected_rows($res) < 1) {
+                       $this->setError('Error: Cannot Update list of hidden 
fields: '.db_error());
+                       return false;
+               }
+               $this->data_array['hidden'] = $serializedData;
+               return true;
+       }
 }
 
 

-----------------------------------------------------------------------

Summary of changes:
 src/common/include/User.class.php | 94 ++++++++++++++++++++++++++++++++++++++-
 1 file changed, 93 insertions(+), 1 deletion(-)


hooks/post-receive
-- 
FusionForge

_______________________________________________
Fusionforge-commits mailing list
[email protected]
http://lists.fusionforge.org/cgi-bin/mailman/listinfo/fusionforge-commits

Reply via email to