Пример #1
0
	/**
	 * Records the basic access data to the assets analytics table
	 *
	 * @return boolean
	 */protected function recordAnalytics($asset_id,$element_id=0) {
		$ip_and_proxy = CASHSystem::getCurrentIP();
		$result = $this->db->setData(
			'assets_analytics',
			array(
				'asset_id' => $asset_id,
				'element_id' => $element_id,
				'access_time' => time(),
				'client_ip' => $ip_and_proxy['ip'],
				'client_proxy' => $ip_and_proxy['proxy'],
				'cash_session_id' => $this->getCASHSessionID()
			)
		);
		return $result;
	}
Пример #2
0
	/**
	 * Records the basic access data to the elements analytics table
	 *
	 * @return boolean
	 */protected function recordAnalytics($element_id,$access_method,$access_action='getmarkup',$access_data='') {
		$ip_and_proxy = CASHSystem::getCurrentIP();
		$already_recorded = false;
		// first check and see if we've recorded this session and circumstance yet
		// only do this for empty lock_method_table queries so we don't repeat
		// unnecessary rows and overwhelm the table
		if ($access_action == 'getmarkup') {
			$already_recorded = $this->db->getData(
				'elements_analytics',
				'id',
				array(
					"element_id" => array(
						"condition" => "=",
						"value" => $element_id
					),
					"access_method" => array(
						"condition" => "=",
						"value" => $access_method
					),
					"access_location" => array(
						"condition" => "=",
						"value" => CASHSystem::getCurrentURL()
					),
					"cash_session_id" => array(
						"condition" => "=",
						"value" => $this->getCASHSessionID()
					),
					"client_ip" => array(
						"condition" => "=",
						"value" => $ip_and_proxy['ip']
					),
					"client_proxy" => array(
						"condition" => "=",
						"value" => $ip_and_proxy['proxy']
					)
				)
			);
		}
		if (!$already_recorded) {
			$result = $this->db->setData(
				'elements_analytics',
				array(
					'element_id' => $element_id,
					'access_method' => $access_method,
					'access_location' => CASHSystem::getCurrentURL(),
					'access_action' => $access_action,
					'access_data' => $access_data,
					'access_time' => time(),
					'client_ip' => $ip_and_proxy['ip'],
					'client_proxy' => $ip_and_proxy['proxy'],
					'cash_session_id' => $this->getCASHSessionID()
				)
			);
			return $result;
		} else {
			return true;
		}
	}