• sdk4php urlencode missing

  • He we will discuss about how to make customization and improvement to the OpenKM source code.
He we will discuss about how to make customization and improvement to the OpenKM source code.
Forum rules: Please, before asking something see the documentation wiki or use the search feature of the forum. And remember we don't have a crystal ball or mental readers, so if you post about an issue tell us which OpenKM are you using and also the browser and operating system version. For more info read How to Report Bugs Effectively.
 #53713  by lbilke
Hello, I've been writing a script that relies on searching for custom property groups using the PHP SDK. I realized that this is impossible due to a missing urlencode() in openKM/src/openkm/impl/SearchImpl.php. The the property encoding in makeUri() should be changed like this:
Code: Select all
@@ -922,7 +922,7 @@
     foreach ($queryParams->getProperties() as $key => $value) {
-      $uri .= '&property=' . $key . '=' . urlencode($value);
+      $uri .= '&property=' . urlencode($key) . '=' . urlencode($value);
     if ($queryParams->getAuthor() != '') {
       $uri .= '&author=' . urlencode($queryParams->getAuthor());
Without the urlencode function around $key, it is impossible to search for properties such as okp:consulting.name, as the colon is not encoded.
What is also unclear is the fact that when you get a saved query using the API, it is impossible to use this query because the properties are in a completely different format. Instead of being in a simple array they are contained in an "Entry" object that is completely incompatible with the makeUri() function of SearchImpl.php

I hope I am not misunderstanding anything but passing the properties to the QueryParams object as a simple array and adding urlencode($key) solved my problems.

About Us

OpenKM is part of the management software. A management software is a program that facilitates the accomplishment of administrative tasks. OpenKM is a document management system that allows you to manage business content and workflow in a more efficient way. Document managers guarantee data protection by establishing information security for business content.