mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-04 01:01:41 +09:00
issue 2740 add unique visitor statistics api
json_encode2 function modify (Because Maserati only supports php5.2.4 above) git-svn-id: http://xe-core.googlecode.com/svn/branches/maserati@12374 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
56110ce3c3
commit
c7fb2d5ae8
4 changed files with 12 additions and 36 deletions
|
|
@ -1109,39 +1109,7 @@ function detectUTF8($string, $return_convert = false, $urldecode = true)
|
|||
*/
|
||||
function json_encode2($data)
|
||||
{
|
||||
switch (gettype($data))
|
||||
{
|
||||
case 'boolean':
|
||||
return $data?'true':'false';
|
||||
case 'integer':
|
||||
case 'double':
|
||||
return $data;
|
||||
case 'string':
|
||||
return '"'.strtr($data, array('\\'=>'\\\\','"'=>'\\"')).'"';
|
||||
case 'object':
|
||||
$data = get_object_vars($data);
|
||||
case 'array':
|
||||
$rel = false; // relative array?
|
||||
$key = array_keys($data);
|
||||
foreach($key as $v)
|
||||
{
|
||||
if(!is_int($v))
|
||||
{
|
||||
$rel = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$arr = array();
|
||||
foreach ($data as $k=>$v)
|
||||
{
|
||||
$arr[] = ($rel?'"'.strtr($k, array('\\'=>'\\\\','"'=>'\\"')).'":':'').json_encode2($v);
|
||||
}
|
||||
|
||||
return $rel?'{'.join(',', $arr).'}':'['.join(',', $arr).']';
|
||||
default:
|
||||
return '""';
|
||||
}
|
||||
return json_encode($data);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,9 +1,12 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<module>
|
||||
<grants />
|
||||
<permissions />
|
||||
<permissions>
|
||||
<permission action="getWeeklyUniqueVisitor" target="manager" />
|
||||
</permissions>
|
||||
<actions>
|
||||
<action name="dispCounterAdminIndex" type="view" standalone="true" admin_index="true" />
|
||||
<action name="procCounterExecute" type="controller" standalone="true" />
|
||||
<action name="getWeeklyUniqueVisitor" type="model" standalone="true" />
|
||||
</actions>
|
||||
</module>
|
||||
|
|
|
|||
|
|
@ -253,6 +253,13 @@ class counterModel extends counter
|
|||
return $status;
|
||||
}
|
||||
|
||||
public function getWeeklyUniqueVisitor()
|
||||
{
|
||||
$date = date('Ymd');
|
||||
$output = $this->getHourlyStatus('week', $date);
|
||||
|
||||
$this->add('data', $output);
|
||||
}
|
||||
}
|
||||
/* End of file counter.model.php */
|
||||
/* Location: ./modules/counter/counter.model.php */
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
<grants />
|
||||
<permissions>
|
||||
<permission action="getApiGroups" target="manager" />
|
||||
<permission action="getMemberAdminCountByDate" target="manager" />
|
||||
</permissions>
|
||||
<actions>
|
||||
<action name="dispMemberInfo" type="view" standalone="true" />
|
||||
|
|
@ -38,7 +37,6 @@
|
|||
<action name="getMemberAdminInsertJoinForm" type="model" />
|
||||
<action name="getMemberAdminIPCheck" type="model" standalone="true" />
|
||||
<action name="getApiGroups" type="model" standalone="true" />
|
||||
<action name="getMemberAdminCountByDate" type="model" standalone="true" />
|
||||
|
||||
<action name="procMemberLogin" type="controller" standalone="true" ruleset="@login" />
|
||||
<action name="procMemberLogout" type="controller" standalone="true" />
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue