load($dms_session)) { echo json_encode(array('error'=>1)); exit; } /* Load user data */ $user = $dms->getUser($resArr["userID"]); if (!is_object($user)) { echo json_encode(array('error'=>1)); exit; } $dms->setUser($user); } else { $user = null; } include $settings->_rootDir . "languages/" . $resArr["language"] . "/lang.inc"; $command = $_GET["command"]; switch($command) { case 'checkpwstrength': $ps = new Password_Strength(); $ps->set_password($_GET["pwd"]); if($settings->_passwordStrengthAlgorithm == 'simple') $ps->simple_calculate(); else $ps->calculate(); $score = $ps->get_score(); if($settings->_passwordStrength) { if($score >= $settings->_passwordStrength) { echo json_encode(array('error'=>0, 'strength'=>$score, 'score'=>$score/$settings->_passwordStrength, 'ok'=>1)); } else { echo json_encode(array('error'=>0, 'strength'=>$score, 'score'=>$score/$settings->_passwordStrength, 'ok'=>0)); } } else { echo json_encode(array('error'=>0, 'strength'=>$score)); } break; case 'searchdocument': if($user) { $query = $_GET['query']; $hits = $dms->search($query, $limit=0, $offset=0, $logicalmode='AND', $searchin=array(), $startFolder=null, $owner=null, $status = array(), $creationstartdate=array(), $creationenddate=array(), $modificationstartdate=array(), $modificationenddate=array(), $categories=array(), $attributes=array(), $mode=0x1, $expirationstartdate=array(), $expirationenddate=array()); if($hits) { $result = array(); foreach($hits['docs'] as $hit) { $result[] = $hit->getID().'#'.$hit->getName(); } header('Content-Type: application/json'); echo json_encode($result); } } break; case 'searchfolder': if($user) { $query = $_GET['query']; $hits = $dms->search($query, $limit=0, $offset=0, $logicalmode='AND', $searchin=array(), $startFolder=null, $owner=null, $status = array(), $creationstartdate=array(), $creationenddate=array(), $modificationstartdate=array(), $modificationenddate=array(), $categories=array(), $attributes=array(), $mode=0x2, $expirationstartdate=array(), $expirationenddate=array()); if($hits) { $result = array(); foreach($hits['folders'] as $hit) { $result[] = $hit->getID().'#'.$hit->getName(); } header('Content-Type: application/json'); echo json_encode($result); } } break; } ?>