globiws

podio_pf_search_all_app_configs

Dec 9th, 2021 (edited)
249
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.88 KB | None | 0 0
  1. // Podio search all app configs for a given string
  2.  
  3. input "Org ID" org
  4. input "string to search for" search_val
  5.  
  6. global results = 0
  7.  
  8. print "searching for " + search_val
  9.  
  10. seartchOrg(org, search_val)
  11.  
  12. print "DONE. Found " + results + " hits"
  13. end
  14.  
  15. function seartchOrg(org, search_val) {
  16.     spaces = podio_org_get_spaces(org)
  17.     foreach ( spaces as space ) {
  18.         if ( space.type == "emp_network" ) continue
  19.         ini_set("max_execution_time", 30)
  20.         searchSpace(space, search_val)
  21.     }
  22. }
  23.  
  24. function searchSpace(space, search_val) {
  25.     apps = podio_space_get_apps(space.space_id)
  26.     foreach ( apps as app ) {
  27.         raw = podio_app_get_raw(app.app_id)
  28.         json = json_encode(raw)
  29.  
  30.         // if we find a hit
  31.         if ( stristr(json, search_val) ) {
  32.             results = results + 1
  33.             line = "App " + app.app_id + ' (<a'+' href="' + raw.link + '" target="_blank">'+raw.config.name+'</a>)'
  34.             print line
  35.         }
  36.     }
  37. }
  38.  
  39.  
Add Comment
Please, Sign In to add comment