public function getPref($prefName)
 {
     $p = parent::getPref($prefName);
     if (isset($p) && is_string($p)) {
         if (strpos($p, '$phpserial$') !== false && strpos($p, '$phpserial$') === 0) {
             $p = substr($p, strlen('$phpserial$'));
             return unserialize($p);
         }
         if (strpos($p, '$json$') !== false && strpos($p, '$json$') === 0) {
             $p = substr($p, strlen('$json$'));
             return json_decode($p, true);
         }
         // By default, unserialize
         if ($prefName == "CUSTOM_PARAMS") {
             return unserialize($p);
         }
     }
     return $p;
 }
 /**
  * @param AbstractAjxpUser $userObject
  * @return array()
  */
 public function getExposedPreferences($userObject)
 {
     $stringPrefs = array("lang", "history/last_repository", "pending_folder", "plugins_preferences");
     $jsonPrefs = array("ls_history", "gui_preferences");
     $prefs = array();
     if ($userObject->getId() == "guest" && ConfService::getCoreConf("SAVE_GUEST_PREFERENCES", "conf") === false) {
         return array();
     }
     if (ConfService::getCoreConf("SKIP_USER_HISTORY", "conf") === true) {
         $stringPrefs = array("lang", "pending_folder", "plugins_preferences");
         $jsonPrefs = array("gui_preferences");
         $prefs["SKIP_USER_HISTORY"] = array("value" => "true", "type" => "string");
     }
     foreach ($stringPrefs as $pref) {
         if (strstr($pref, "/") !== false) {
             $parts = explode("/", $pref);
             $value = $userObject->getArrayPref($parts[0], $parts[1]);
             $pref = str_replace("/", "_", $pref);
         } else {
             $value = $userObject->getPref($pref);
         }
         $prefs[$pref] = array("value" => $value, "type" => "string");
     }
     foreach ($jsonPrefs as $pref) {
         $prefs[$pref] = array("value" => $userObject->getPref($pref), "type" => "json");
     }
     $paramNodes = AJXP_PluginsService::searchAllManifests("//server_settings/param[contains(@scope,'user') and @expose='true']", "node", false, false, true);
     if (is_array($paramNodes) && count($paramNodes)) {
         foreach ($paramNodes as $xmlNode) {
             if ($xmlNode->getAttribute("expose") == "true") {
                 $parentNode = $xmlNode->parentNode->parentNode;
                 $pluginId = $parentNode->getAttribute("id");
                 if (empty($pluginId)) {
                     $pluginId = $parentNode->nodeName . "." . $parentNode->getAttribute("name");
                 }
                 $name = $xmlNode->getAttribute("name");
                 $value = $userObject->mergedRole->filterParameterValue($pluginId, $name, AJXP_REPO_SCOPE_ALL, "");
                 $prefs[$name] = array("value" => $value, "type" => "string", "pluginId" => $pluginId);
             }
         }
     }
     return $prefs;
 }
 function getPref($prefName)
 {
     $p = parent::getPref($prefName);
     if (isset($p)) {
         if (strpos($p, '$phpserial$') !== false && strpos($p, '$phpserial$') === 0) {
             $p = substr($p, strlen('$phpserial$'));
             return unserialize($p);
         }
         // old method
         if ($prefName == "CUSTOM_PARAMS") {
             return unserialize($p);
         }
     }
     return $p;
 }
 /**
  * @param AbstractAjxpUser $userObject
  * @return array()
  */
 public function getExposedPreferences($userObject)
 {
     $stringPrefs = array("lang", "history/last_repository", "pending_folder", "plugins_preferences");
     $jsonPrefs = array("ls_history", "gui_preferences");
     $prefs = array();
     if ($userObject->getId() == "guest" && ConfService::getCoreConf("SAVE_GUEST_PREFERENCES", "conf") === false) {
         return array();
     }
     if (ConfService::getCoreConf("SKIP_USER_HISTORY", "conf") === true) {
         $stringPrefs = array("lang", "pending_folder", "plugins_preferences");
         $jsonPrefs = array("gui_preferences");
         $prefs["SKIP_USER_HISTORY"] = array("value" => "true", "type" => "string");
     }
     foreach ($stringPrefs as $pref) {
         if (strstr($pref, "/") !== false) {
             $parts = explode("/", $pref);
             $value = $userObject->getArrayPref($parts[0], $parts[1]);
             $pref = str_replace("/", "_", $pref);
         } else {
             $value = $userObject->getPref($pref);
         }
         $prefs[$pref] = array("value" => $value, "type" => "string");
     }
     foreach ($jsonPrefs as $pref) {
         $prefs[$pref] = array("value" => $userObject->getPref($pref), "type" => "json");
     }
     $exposed = array();
     $cacheHasExposed = AJXP_PluginsService::getInstance()->loadFromPluginQueriesCache("//server_settings/param[contains(@scope,'user') and @expose='true']");
     if ($cacheHasExposed !== null && is_array($cacheHasExposed)) {
         $exposed = $cacheHasExposed;
     } else {
         $exposed_props = AJXP_PluginsService::searchAllManifests("//server_settings/param[contains(@scope,'user') and @expose='true']", "node", false, false, true);
         foreach ($exposed_props as $exposed_prop) {
             $parentNode = $exposed_prop->parentNode->parentNode;
             $pluginId = $parentNode->getAttribute("id");
             if (empty($pluginId)) {
                 $pluginId = $parentNode->nodeName . "." . $parentNode->getAttribute("name");
             }
             $paramName = $exposed_prop->getAttribute("name");
             $exposed[] = array("PLUGIN_ID" => $pluginId, "NAME" => $paramName);
         }
         AJXP_PluginsService::getInstance()->storeToPluginQueriesCache("//server_settings/param[contains(@scope,'user') and @expose='true']", $exposed);
     }
     foreach ($exposed as $exposedProp) {
         $value = $userObject->mergedRole->filterParameterValue($exposedProp["PLUGIN_ID"], $exposedProp["NAME"], AJXP_REPO_SCOPE_ALL, "");
         $prefs[$exposedProp["NAME"]] = array("value" => $value, "type" => "string", "pluginId" => $exposedProp["PLUGIN_ID"]);
     }
     return $prefs;
 }
 /**
  * @param AbstractAjxpUser $userObject
  * @return array()
  */
 function getExposedPreferences($userObject)
 {
     $stringPrefs = array("display", "lang", "diapo_autofit", "sidebar_splitter_size", "vertical_splitter_size", "history/last_repository", "pending_folder", "thumb_size", "plugins_preferences", "upload_auto_send", "upload_auto_close", "upload_existing", "action_bar_style", "force_default_repository");
     $jsonPrefs = array("ls_history", "columns_size", "columns_visibility", "gui_preferences");
     $prefs = array();
     if ($userObject->getId() == "guest" && ConfService::getCoreConf("SAVE_GUEST_PREFERENCES", "conf") === false) {
         return array();
     }
     if (ConfService::getCoreConf("SKIP_USER_HISTORY", "conf") === true) {
         $stringPrefs = array_diff($stringPrefs, array("history/last_repository"));
         $jsonPrefs = array("columns_size", "columns_visibility", "gui_preferences");
     }
     foreach ($stringPrefs as $pref) {
         if (strstr($pref, "/") !== false) {
             $parts = explode("/", $pref);
             $value = $userObject->getArrayPref($parts[0], $parts[1]);
             $pref = str_replace("/", "_", $pref);
         } else {
             $value = $userObject->getPref($pref);
         }
         $prefs[$pref] = array("value" => $value, "type" => "string");
     }
     foreach ($jsonPrefs as $pref) {
         $prefs[$pref] = array("value" => $userObject->getPref($pref), "type" => "json");
     }
     return $prefs;
 }