*/
public function addView($viewer_guid)
{
- if ($viewer_guid != $this->owner_guid)
+ if ($viewer_guid != $this->owner_guid && tp_is_person())
create_annotation($this->getGUID(), "tp_view", "1", "integer", $viewer_guid, ACCESS_PUBLIC);
}
}
\r
/*********************************************************************\r
* the functions below replace broken core functions or add functions \r
- * that should exist in the core\r
+ * that could/should exist in the core\r
*/\r
\r
/**\r
\r
}\r
\r
+ /**\r
+ * Is page owner a group - convenience function\r
+ * \r
+ * @return true/false\r
+ */\r
function tp_is_group_page() {\r
\r
if ($group = page_owner_entity()) {\r
return false;\r
}\r
\r
+ \r
+ /**\r
+ * Is the request from a known browser\r
+ * \r
+ * @return true/false\r
+ */\r
+ function tp_is_person()\r
+ {\r
+ $known = array('msie', 'mozilla', 'firefox', 'safari', 'webkit', 'opera', 'netscape', 'konqueror', 'gecko');\r
+ \r
+ $agent = strtolower($_SERVER['HTTP_USER_AGENT']);\r
+ \r
+ foreach ($known as $browser)\r
+ {\r
+ if (strpos($agent, $browser) !== false) {\r
+ return true;\r
+ }\r
+ }\r
+ \r
+ return false;\r
+ }\r
?>
\ No newline at end of file