예제 #1
0
파일: api.php 프로젝트: logiks/logiks-core
 function isAjax()
 {
     if (_server('HTTP_REFERER')) {
         $x = _server('HTTP_X_REQUESTED_WITH');
         if (isset($_REQUEST['syshash']) && $_REQUEST['syshash'] == getSysHash()) {
             return true;
         } elseif ($x) {
             $isAjax = $x and strtolower($x) === 'xmlhttprequest';
             if ($isAjax) {
                 return true;
             }
         }
     } elseif (isset($_REQUEST['syshash']) && $_REQUEST['syshash'] == getSysHash()) {
         return true;
     }
     return false;
 }
예제 #2
0
 function _service($scmd, $action = "", $format = "json", $params = array(), $site = SITENAME)
 {
     //$s=SiteLocation."services/{$scmd}?site={$site}";
     $s = SiteLocation . "services/{$scmd}?site={$site}&syshash=" . getSysHash();
     if (strlen($action) > 0) {
         $s .= "&action={$action}";
     }
     if (strlen($format) > 0) {
         $s .= "&format={$format}";
     }
     if (is_array($params)) {
         foreach ($params as $a => $b) {
             $s .= "&{$a}={$b}";
         }
     }
     return $s;
 }
예제 #3
0
function getServiceCMD(cmd,action,q) {
	return _service(cmd,action,null,q);
}
function _service(cmd,action,format,q) {
	if(cmd==null || cmd.length<=0) {
		return "";
	}
	sxx="<?php 
echo SiteLocation;
?>
services/"+cmd+"?site=<?php 
echo SITENAME;
?>
&syshash=<?php 
echo getSysHash();
?>
";
	<?php 
if (isset($_REQUEST["forsite"]) && strlen($_REQUEST["forsite"]) > 0) {
    echo "sxx+='&forsite={$_REQUEST["forsite"]}';";
}
?>
	
	if(action!=null && action.length>0) {
		sxx+="&action="+action;
	}
	if(format!=null && format.length>0) {
		sxx+="&format="+format;
	}
	if(q!=null && q.length>0) {