]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
* Remove evil transaction
authorZach Copley <zach@status.net>
Thu, 10 Mar 2011 03:27:21 +0000 (19:27 -0800)
committerZach Copley <zach@status.net>
Thu, 10 Mar 2011 03:27:21 +0000 (19:27 -0800)
* Fix text value retrieval method

plugins/ExtendedProfile/extendedprofile.php
plugins/ExtendedProfile/profiledetailsettingsaction.php

index 43f5b55b9cf22049c22d3bd8dcc4a6bd29a73f9a..5ad6db114fc87f5aa8f642c155bccd68eeaac531 100644 (file)
@@ -26,6 +26,8 @@ if (!defined('STATUSNET')) {
  */
 class ExtendedProfile
 {
+    protected $fields;
+
     /**
      * Constructor
      *
@@ -82,12 +84,13 @@ class ExtendedProfile
      */
     function getTextValue($name)
     {
+        $key           = strtolower($name);
         $profileFields = array('fullname', 'location', 'bio');
 
-        if (in_array(strtolower($name), $profileFields)) {
+        if (in_array($key, $profileFields)) {
             return $this->profile->$name;
-        } else if (in_array($name, $this->fields)) {
-            return $this->fields[$name]->field_value;
+        } else if (array_key_exists($key, $this->fields)) {
+            return $this->fields[$key][0]->field_value;
         } else {
             return null;
         }
index 1f2be5a060afdc360c795f81ebcc7397cc5d65f3..7c68216972555eb6275e8e61947fc18aaf77d010 100644 (file)
@@ -74,7 +74,11 @@ class ProfileDetailSettingsAction extends SettingsAction
         $cur = common_current_user();
         $profile = $cur->getProfile();
 
-        $widget = new ExtendedProfileWidget($this, $profile, ExtendedProfileWidget::EDITABLE);
+        $widget = new ExtendedProfileWidget(
+            $this,
+            $profile,
+            ExtendedProfileWidget::EDITABLE
+        );
         $widget->show();
     }
 
@@ -154,8 +158,6 @@ class ProfileDetailSettingsAction extends SettingsAction
      */
     function saveStandardProfileDetails($user)
     {
-        $user->query('BEGIN');
-
         $fullname  = $this->trimmed('extprofile-fullname');
         $location  = $this->trimmed('extprofile-location');
         $tagstring = $this->trimmed('extprofile-tags');
@@ -187,7 +189,7 @@ class ProfileDetailSettingsAction extends SettingsAction
             || $location != $profile->location
             || !empty($newTags)
             || $bio      != $profile->bio) {
-
             $orig = clone($profile);
 
             $profile->nickname = $user->nickname;
@@ -229,7 +231,6 @@ class ProfileDetailSettingsAction extends SettingsAction
                 return;
             }
 
-            $user->query('COMMIT');
             Event::handle('EndProfileSaveForm', array($this));
             common_broadcast_profile($profile);
         }