Commit 8f7071c2028d00b81e9ff2cf13507f5b7562a658
Merge branch 'edge' of github.com:ktgit/knowledgetree into edge
Showing
3 changed files
with
38 additions
and
16 deletions
webservice/clienttools/jsonWrapper.php
| ... | ... | @@ -91,6 +91,7 @@ class jsonWrapper{ |
| 91 | 91 | public $jsonArray=array(); |
| 92 | 92 | |
| 93 | 93 | public function __construct($content=NULL){ |
| 94 | + $content=stripslashes($content); | |
| 94 | 95 | $this->raw=$content; |
| 95 | 96 | $content=@json_decode($content,true); |
| 96 | 97 | if(!is_array($content))throw new jsonContentException('Invalid JSON input',jsonContentException::INPUT_ERROR); | ... | ... |
webservice/clienttools/services/0.2/kt.php
| ... | ... | @@ -855,7 +855,7 @@ class kt extends client_service { |
| 855 | 855 | |
| 856 | 856 | |
| 857 | 857 | private function update_document_metadata($session_id, $document_id, $metadata, $application, $sysdata=null){ |
| 858 | - $this->addDebug('','entered update_document_metadata'); | |
| 858 | + $this->addDebug('update_document_metadata','entered update_document_metadata'); | |
| 859 | 859 | $kt=&$this->KT; |
| 860 | 860 | $responseType='kt_document_detail'; |
| 861 | 861 | |
| ... | ... | @@ -923,27 +923,44 @@ class kt extends client_service { |
| 923 | 923 | |
| 924 | 924 | public function update_metadata($arr){ |
| 925 | 925 | $metadata=array(); |
| 926 | - $packed=@json_decode($arr['metadata']); | |
| 926 | + $meta=$arr['metadata']; | |
| 927 | 927 | |
| 928 | 928 | $this->addDebug('','Entered add_document_with_metadata'); |
| 929 | + $this->addDebug('metadata received',$meta); | |
| 929 | 930 | |
| 930 | 931 | $special=array(); |
| 931 | - | |
| 932 | - foreach($packed as $key=>$val) { | |
| 933 | - if(substr($val->name,0,2) != '__') { | |
| 934 | - if(!is_array($metadata[$val->fieldset])) { | |
| 935 | - $metadata[$val->fieldset]['fieldset']=$val->fieldset; | |
| 936 | - $metadata[$val->fieldset]['fields']=array(); | |
| 937 | - } | |
| 938 | - $metadata[$val->fieldset]['fields'][]=array( | |
| 939 | - 'name'=>$val->name, | |
| 940 | - 'value'=>$val->value | |
| 941 | - ); | |
| 932 | +// foreach($apacked as $packed){ | |
| 933 | +// foreach($packed as $key=>$val) { | |
| 934 | +// if(substr($val->name,0,2) != '__') { | |
| 935 | +// if(!is_array($metadata[$val->fieldset])) { | |
| 936 | +// $metadata[$val->fieldset]['fieldset']=$val->fieldset; | |
| 937 | +// $metadata[$val->fieldset]['fields']=array(); | |
| 938 | +// } | |
| 939 | +// $metadata[$val->fieldset]['fields'][]=array( | |
| 940 | +// 'name'=>$val->name, | |
| 941 | +// 'value'=>$val->value | |
| 942 | +// ); | |
| 943 | +// }else{ | |
| 944 | +// $special[$val->name]=$val->value; | |
| 945 | +// } | |
| 946 | +// } | |
| 947 | +// } | |
| 948 | + | |
| 949 | + foreach($meta as $item){ | |
| 950 | + $isSpecial=substr($item['name'],0,2)=='__'; | |
| 951 | + if($isSpecial){ | |
| 952 | + $special[$item['name']]=$item['value']; | |
| 942 | 953 | }else{ |
| 943 | - $special[$val->name]=$val->value; | |
| 944 | - } | |
| 954 | + $fieldSet=$item['fieldset']; | |
| 955 | + unset($item['fieldset']); | |
| 956 | + $metadata[$fieldSet]['fieldset']=$fieldSet; | |
| 957 | + $metadata[$fieldSet]['fields'][]=$item; | |
| 958 | + } | |
| 945 | 959 | } |
| 946 | - | |
| 960 | + | |
| 961 | + | |
| 962 | + $this->addDebug('after processing',array('metadata'=>$metadata,'special'=>$special)); | |
| 963 | + | |
| 947 | 964 | $document_id=$arr['document_id']; |
| 948 | 965 | |
| 949 | 966 | $update_result=$this->update_document_metadata($arr['session_id'], $document_id, $metadata, $arr['application'], array()); | ... | ... |
webservice/clienttools/standardservices/system.php
| ... | ... | @@ -21,6 +21,10 @@ class system extends client_service{ |
| 21 | 21 | $this->setResponse($ret); |
| 22 | 22 | return true; |
| 23 | 23 | } |
| 24 | + | |
| 25 | + public function jsondecode($params){ | |
| 26 | + $this->setResponse(@json_decode(trim($params['code']))); | |
| 27 | + } | |
| 24 | 28 | } |
| 25 | 29 | |
| 26 | 30 | ?> |
| 27 | 31 | \ No newline at end of file | ... | ... |