[ Index ] |
PHP Cross Reference of vtigercrm-6.1.0 |
[Summary view] [Print] [Text view]
1 <?php 2 /*+*********************************************************************************** 3 * The contents of this file are subject to the vtiger CRM Public License Version 1.0 4 * ("License"); You may not use this file except in compliance with the License 5 * The Original Code is: vtiger CRM Open Source 6 * The Initial Developer of the Original Code is vtiger. 7 * Portions created by vtiger are Copyright (C) vtiger. 8 * All Rights Reserved. 9 *************************************************************************************/ 10 11 require_once ("include/Webservices/QueryParser.php"); 12 13 function vtws_query($q,$user){ 14 15 static $vtws_query_cache = array(); 16 17 global $log,$adb; 18 19 // Cache the instance for re-use 20 $moduleRegex = "/[fF][rR][Oo][Mm]\s+([^\s;]+)/"; 21 $moduleName = ''; 22 if(preg_match($moduleRegex, $q, $m)) $moduleName = trim($m[1]); 23 24 if(!isset($vtws_create_cache[$moduleName]['webserviceobject'])) { 25 $webserviceObject = VtigerWebserviceObject::fromQuery($adb,$q); 26 $vtws_query_cache[$moduleName]['webserviceobject'] = $webserviceObject; 27 } else { 28 $webserviceObject = $vtws_query_cache[$moduleName]['webserviceobject']; 29 } 30 // END 31 32 $handlerPath = $webserviceObject->getHandlerPath(); 33 $handlerClass = $webserviceObject->getHandlerClass(); 34 35 require_once $handlerPath; 36 37 // Cache the instance for re-use 38 if(!isset($vtws_query_cache[$moduleName]['handler'])) { 39 $handler = new $handlerClass($webserviceObject,$user,$adb,$log); 40 $vtws_query_cache[$moduleName]['handler'] = $handler; 41 } else { 42 $handler = $vtws_query_cache[$moduleName]['handler']; 43 } 44 // END 45 46 // Cache the instance for re-use 47 if(!isset($vtws_query_cache[$moduleName]['meta'])) { 48 $meta = $handler->getMeta(); 49 $vtws_query_cache[$moduleName]['meta'] = $meta; 50 } else { 51 $meta = $vtws_query_cache[$moduleName]['meta']; 52 } 53 // END 54 55 $types = vtws_listtypes(null, $user); 56 if(!in_array($webserviceObject->getEntityName(),$types['types'])){ 57 throw new WebServiceException(WebServiceErrorCode::$ACCESSDENIED,"Permission to perform the operation is denied"); 58 } 59 60 if(!$meta->hasReadAccess()){ 61 throw new WebServiceException(WebServiceErrorCode::$ACCESSDENIED,"Permission to read is denied"); 62 } 63 64 $result = $handler->query($q); 65 VTWS_PreserveGlobal::flush(); 66 return $result; 67 } 68 69 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Nov 28 20:08:37 2014 | Cross-referenced by PHPXref 0.7.1 |