Fixes bugs in name edition.
[platal.git] / classes / profile.php
index c2cb842..53d9100 100644 (file)
@@ -197,7 +197,11 @@ class Profile
 
     public function mainEducation()
     {
-        return $this->promo{0};
+        if (empty($this->promo)) {
+            return null;
+        } else {
+            return $this->promo{0};
+        }
     }
 
     public function mainEducationDuration()
@@ -447,7 +451,10 @@ class Profile
     public function getAddresses($flags, $limit = null)
     {
         if ($this->addresses == null  && !$this->fetched(self::FETCH_ADDRESSES)) {
-            $this->setAddresses($this->getProfileField(self::FETCH_ADDRESSES));
+            $addr = $this->getProfileField(self::FETCH_ADDRESSES);
+            if ($addr) {
+                $this->setAddresses($addr);
+            }
         }
 
         if ($this->addresses == null) {
@@ -544,7 +551,10 @@ class Profile
     public function getNetworking($flags, $limit = null)
     {
         if ($this->networks == null && !$this->fetched(self::FETCH_NETWORKING)) {
-            $this->setNetworking($this->getProfileField(self::FETCH_NETWORKING));
+            $nw = $this->getProfileField(self::FETCH_NETWORKING);
+            if ($nw) {
+                $this->setNetworking($nw);
+            }
         }
         if ($this->networks == null) {
             return array();
@@ -559,7 +569,7 @@ class Profile
             return null;
         }
         $site = array_pop($site);
-        return $site['address'];
+        return $site;
     }
 
 
@@ -575,7 +585,10 @@ class Profile
     public function getJobs($flags, $limit = null)
     {
         if ($this->jobs == null && !$this->fetched(self::FETCH_JOBS)) {
-            $this->setJobs($this->getProfileField(self::FETCH_JOBS));
+            $jobs = $this->getProfileField(self::FETCH_JOBS);
+            if ($jobs) {
+                $this->setJobs($jobs);
+            }
         }
 
         if ($this->jobs == null) {