diff --git a/conf/db_config.php.dist b/conf/db_config.php.dist index 5ad43ae21..cd912c32f 100644 --- a/conf/db_config.php.dist +++ b/conf/db_config.php.dist @@ -33,6 +33,9 @@ define('OWA_DB_NAME', ''); define('OWA_DB_HOST', ''); define('OWA_DB_USER', ''); define('OWA_DB_PASSWORD', ''); + +// define the URI of the public directory e.g. /root/deir/owa/public +define('OWA_PUBLIC_URL', dirname(dirname($_SERVER['PHP_SELF'])).'/public'); ?> \ No newline at end of file diff --git a/conf/messages.php b/conf/messages.php index 27cc0a370..a5c762cf7 100644 --- a/conf/messages.php +++ b/conf/messages.php @@ -40,7 +40,10 @@ 2010 => array("Sucess. Logout Complete.",0), // Options/Configuration related -2500 => array("Options Saved."), +2500 => array("Options Saved.",0), +2501 => array("The module was activated successfully.",0), +2502 => array("The module was deactivated successfully.",0), +2503 => array("Options reset to Default Values.",0), //User managment 3000 => array("Success. User Added.", 0), @@ -72,7 +75,10 @@ 3306 => array("Error. User id already exists for some reason.",0), // Graph related -3500 => array("There is no data for\nthis time period.",0) +3500 => array("There is no data for\nthis time period.",0), + +// Report Related +3600 => array("Unknown",0) ); diff --git a/modules/base/classes/event.php b/modules/base/classes/event.php index f770c778c..a0087082f 100644 --- a/modules/base/classes/event.php +++ b/modules/base/classes/event.php @@ -1,373 +1,362 @@ - - * @copyright Copyright © 2006 Peter Adams - * @license http://www.gnu.org/copyleft/gpl.html GPL v2.0 - * @category owa - * @package owa - * @version $Revision$ - * @since owa 1.0.0 - */ - -class owa_event extends owa_base { - - /** - * Event Properties - * - * @var array - */ - var $properties = array(); - - /** - * Event Queue - * - * @var object - */ - var $eq; - - /** - * State - * - * @var string - */ - var $state; - - /** - * Time since last request. - * - * Used to tell if a new session should be created. - * - * @var integer $time_since_lastreq - */ - var $time_since_lastreq; - - /** - * Event guid - * - * @var string - */ - var $guid; - - /** - * Constructor - * @access public - */ - function owa_event() { - - $this->owa_base(); - - // Load event queue - $this->eq = &eventQueue::get_instance(); - - // Set GUID for event - $this->guid = $this->set_guid(); - $this->properties['guid'] = $this->guid; - - // Assume browser untill told otherwise - $this->properties['is_browser'] = true; - - return; - } - - /** - * Sets time related event properties - * - * @param integer $timestamp - */ - function setTime($timestamp = '') { - - $this->properties['timestamp'] = $this->properties['REQUEST_TIME']; - $this->properties['year'] = date("Y", $this->properties['timestamp']); - $this->properties['month'] = date("n", $this->properties['timestamp']); - $this->properties['day'] = date("d", $this->properties['timestamp']); - $this->properties['dayofweek'] = date("D", $this->properties['timestamp']); - $this->properties['dayofyear'] = date("z", $this->properties['timestamp']); - $this->properties['weekofyear'] = date("W", $this->properties['timestamp']); - $this->properties['hour'] = date("G", $this->properties['timestamp']); - $this->properties['minute'] = date("i", $this->properties['timestamp']); - $this->properties['second'] = date("s", $this->properties['timestamp']); - - //epoc time - list($msec, $sec) = explode(" ", microtime()); - $this->properties['sec'] = $sec; - $this->properties['msec'] = $msec; - - // Calc time sinse the last request - $this->time_since_lastreq = $this->timeSinceLastRequest(); - - } - - function setCookieDomain($domain) { - - $cookie_domain = $domain; - - return $cookie_domain; - - } - - /** - * Determines the time since the last request from this borwser - * - * @access private - * @return integer - */ - function timeSinceLastRequest() { - - return ($this->properties['timestamp'] - $this->properties['last_req']); - - } - - function setBrowser() { - - $this->properties['browser_type'] = $this->properties['browscap_Browser']; - - $this->properties['browser'] = $this->properties['browscap_Browser'] . ' ' . $this->properties['browscap_Version']; - - } - - /** - * Logs event to event queue - * - */ - function log() { - - $this->e->debug('Logging '.$this->state.' to event queue...'); - return $this->eq->log($this->properties, $this->state); - - } - - function logEvent($event_type, $properties) { - - $this->e->debug('Logging '.$event_type.' to event queue...'); - return $this->eq->log($properties, $event_type); - - } - - /** - * Applies calling application specific properties to request - * - * @access private - * @param array $properties - */ - function _setProperties($properties = null) { - - if(!empty($properties)): - - foreach ($properties as $key => $value) { - if (!empty($value)): - $this->properties[$key] = $value; - endif; - - } - - // Map standard params to standard event property names - $this->properties['inbound_visitor_id'] = $properties[$this->config['visitor_param']]; - $this->properties['inbound_session_id'] = $properties[$this->config['session_param']]; - $this->properties['last_req'] = $properties[$this->config['last_request_param']]; - - endif; - - return; - } - - function cleanQueryStrings() { - - $properties = array('page_url', 'page_uri', 'target_url'); - - foreach ($properties as $key) { - - if (!empty($this->properties[$key])): - $this->properties[$key] = $this->stripDocumentUrl($this->properties[$key]); - endif; - - } - - return; - } - - - /** - * Get IP address from request - * - * @return string - * @access private - */ - function setIp() { - - if ($this->properties["HTTP_X_FORWARDED_FOR"]): - if ($this->properties["HTTP_CLIENT_IP"]): - $proxy = $this->properties["HTTP_CLIENT_IP"]; - else: - $proxy = $this->properties["REMOTE_ADDR"]; - endif; - - $this->properties['ip_address'] = $this->properties["HTTP_X_FORWARDED_FOR"]; - else: - if ($this->properties["HTTP_CLIENT_IP"]): - $this->properties['ip_address'] = $this->properties["HTTP_CLIENT_IP"]; - else: - $this->properties['ip_address'] = $this->properties["REMOTE_ADDR"]; - endif; - endif; - - return; - - } - - /** - * Create guid from process id - * - * @return integer - * @access private - */ - function set_guid() { - - return crc32(posix_getpid().$this->properties['sec'].$this->properties['msec'].rand()); - - } - - /** - * Create guid from string - * - * @param string $string - * @return integer - * @access private - */ - function set_string_guid($string) { - - return crc32(strtolower($string)); - - } - - /** - * Resolve hostname from IP address - * - * @access public - */ - function setHost($remote_host) { - - // See if host is already resolved - if (!empty($remote_host)): - // Use pre-resolved host if available - $fullhost = $remote_host; - else: - // Do the host lookup - if ($this->config['resolve_hosts'] = true): - $fullhost = gethostbyaddr($this->properties['ip_address']); - endif; - endif; - - if (!empty($fullhost)): - - // Sometimes gethostbyaddr returns 'unknown' or the IP address if it can't resolve the host - if ($fullhost != $this->properties['ip_address']): - - $host_array = explode('.', $fullhost); - - // resort so top level domain is first in array - $host_array = array_reverse($host_array); - - // array of tlds. this should probably be in the config array not here. - $tlds = array('com', 'net', 'org', 'gov', 'mil'); - - if (in_array($host_array[0], $tlds)): - $host = $host_array[1].".".$host_array[0]; - else: - $host = $host_array[2].".".$host_array[1].".".$host_array[0]; - endif; - - elseif ($fullhost == 'unknown'): - // Show the IP it's better than nothing. Should probably mark a dirty flag in the db - // when this happens so one can go back and try again later. - $host = $this->properties['ip_address']; - $fullhost = $this->properties['ip_address']; - else: - $host = $fullhost; - endif; - - $this->properties['host'] = $host; - $this->properties['full_host'] = $fullhost; - - endif; - - return; - } - - /** - * Strip a URL of certain GET params - * - * @return string - */ - function stripDocumentUrl($url) { - - if (!empty($this->config['query_string_filters'])): - $filters = str_replace(' ', '', $this->config['query_string_filters']); - $filters = explode(',', $filters); - else: - $filters = array(); - endif; - - // OWA specific params to filter - array_push($filters, $this->config['source_param']); - array_push($filters, $this->config['ns'].$this->config['feed_subscription_id']); - - //print_r($filters); - - foreach ($filters as $filter => $value) { - - $url = preg_replace( - '#\?' . - $value . - '=.*$|&' . - $value . - '=.*$|' . - $value . - '=.*&#msiU', - '', - $url - ); - - } - - //print $url; - - return $url; - - } - - /** - * Attempts to make a unique ID out of http request variables. - * This should only be used when storing state in a cookie is impossible. - * - * @return integer - */ - function setEnvGUID() { - - return crc32($this->properties['ua'].$this->properties['ip_address']); - - } -} - + + * @copyright Copyright © 2006 Peter Adams + * @license http://www.gnu.org/copyleft/gpl.html GPL v2.0 + * @category owa + * @package owa + * @version $Revision$ + * @since owa 1.0.0 + */ + +class owa_event extends owa_base { + + /** + * Event Properties + * + * @var array + */ + var $properties = array(); + + /** + * Event Queue + * + * @var object + */ + var $eq; + + /** + * State + * + * @var string + */ + var $state; + + /** + * Time since last request. + * + * Used to tell if a new session should be created. + * + * @var integer $time_since_lastreq + */ + var $time_since_lastreq; + + /** + * Event guid + * + * @var string + */ + var $guid; + + /** + * Constructor + * @access public + */ + function owa_event() { + + $this->owa_base(); + + // Load event queue + $this->eq = &eventQueue::get_instance(); + + // Set GUID for event + $this->guid = $this->set_guid(); + $this->properties['guid'] = $this->guid; + + // Assume browser untill told otherwise + $this->properties['is_browser'] = true; + + return; + } + + /** + * Sets time related event properties + * + * @param integer $timestamp + */ + function setTime($timestamp = '') { + + $this->properties['timestamp'] = $timestamp; + $this->properties['year'] = date("Y", $this->properties['timestamp']); + $this->properties['month'] = date("n", $this->properties['timestamp']); + $this->properties['day'] = date("d", $this->properties['timestamp']); + $this->properties['dayofweek'] = date("D", $this->properties['timestamp']); + $this->properties['dayofyear'] = date("z", $this->properties['timestamp']); + $this->properties['weekofyear'] = date("W", $this->properties['timestamp']); + $this->properties['hour'] = date("G", $this->properties['timestamp']); + $this->properties['minute'] = date("i", $this->properties['timestamp']); + $this->properties['second'] = date("s", $this->properties['timestamp']); + + //epoc time + list($msec, $sec) = explode(" ", microtime()); + $this->properties['sec'] = $sec; + $this->properties['msec'] = $msec; + + // Calc time sinse the last request + $this->time_since_lastreq = $this->timeSinceLastRequest(); + + } + + function setCookieDomain($domain) { + + $this->properties['cookie_domain'] = $domain; + + return; + + } + + /** + * Determines the time since the last request from this borwser + * + * @access private + * @return integer + */ + function timeSinceLastRequest() { + + return ($this->properties['timestamp'] - $this->properties['last_req']); + + } + + /** + * Logs event to event queue + * + */ + function log() { + + $this->e->debug('Logging '.$this->state.' to event queue...'); + return $this->eq->log($this->properties, $this->state); + + } + + function logEvent($event_type, $properties) { + + $this->e->debug('Logging '.$event_type.' to event queue...'); + return $this->eq->log($properties, $event_type); + + } + + /** + * Applies calling application specific properties to request + * + * @access private + * @param array $properties + */ + function _setProperties($properties = null) { + + if(!empty($properties)): + + foreach ($properties as $key => $value) { + if (!empty($value)): + $this->properties[$key] = $value; + endif; + + } + + + + endif; + + return; + } + + function cleanQueryStrings() { + + $properties = array('page_url', 'page_uri', 'target_url'); + + foreach ($properties as $key) { + + if (!empty($this->properties[$key])): + $this->properties[$key] = $this->stripDocumentUrl($this->properties[$key]); + endif; + + } + + return; + } + + + /** + * Get IP address from request + * + * @return string + * @access private + */ + function setIp($HTTP_X_FORWARDED_FOR, $HTTP_CLIENT_IP, $REMOTE_ADDR) { + + if ($HTTP_X_FORWARDED_FOR): + if ($HTTP_CLIENT_IP): + $proxy = $HTTP_CLIENT_IP; + else: + $proxy = $REMOTE_ADDR; + endif; + + $this->properties['ip_address'] = $HTTP_X_FORWARDED_FOR; + else: + if ($HTTP_CLIENT_IP): + $this->properties['ip_address'] = $HTTP_CLIENT_IP; + else: + $this->properties['ip_address'] = $REMOTE_ADDR; + endif; + endif; + + return; + + } + + /** + * Create guid from process id + * + * @return integer + * @access private + */ + function set_guid() { + + return crc32(posix_getpid().$this->properties['sec'].$this->properties['msec'].rand()); + + } + + /** + * Create guid from string + * + * @param string $string + * @return integer + * @access private + */ + function set_string_guid($string) { + + return crc32(strtolower($string)); + + } + + /** + * Resolve hostname from IP address + * + * @access public + */ + function setHost($remote_host) { + + // See if host is already resolved + if (!empty($remote_host)): + // Use pre-resolved host if available + $fullhost = $remote_host; + else: + // Do the host lookup + if ($this->config['resolve_hosts'] = true): + $fullhost = gethostbyaddr($this->properties['ip_address']); + endif; + endif; + + if (!empty($fullhost)): + + // Sometimes gethostbyaddr returns 'unknown' or the IP address if it can't resolve the host + if ($fullhost != $this->properties['ip_address']): + + $host_array = explode('.', $fullhost); + + // resort so top level domain is first in array + $host_array = array_reverse($host_array); + + // array of tlds. this should probably be in the config array not here. + $tlds = array('com', 'net', 'org', 'gov', 'mil'); + + if (in_array($host_array[0], $tlds)): + $host = $host_array[1].".".$host_array[0]; + else: + $host = $host_array[2].".".$host_array[1].".".$host_array[0]; + endif; + + elseif ($fullhost == 'unknown'): + // Show the IP it's better than nothing. Should probably mark a dirty flag in the db + // when this happens so one can go back and try again later. + $host = $this->properties['ip_address']; + $fullhost = $this->properties['ip_address']; + else: + $host = $fullhost; + endif; + + $this->properties['host'] = $host; + $this->properties['full_host'] = $fullhost; + + endif; + + return; + } + + /** + * Strip a URL of certain GET params + * + * @return string + */ + function stripDocumentUrl($url) { + + if (!empty($this->config['query_string_filters'])): + $filters = str_replace(' ', '', $this->config['query_string_filters']); + $filters = explode(',', $filters); + else: + $filters = array(); + endif; + + // OWA specific params to filter + array_push($filters, $this->config['source_param']); + array_push($filters, $this->config['ns'].$this->config['feed_subscription_id']); + + //print_r($filters); + + foreach ($filters as $filter => $value) { + + $url = preg_replace( + '#\?' . + $value . + '=.*$|&' . + $value . + '=.*$|' . + $value . + '=.*&#msiU', + '', + $url + ); + + } + + //print $url; + + return $url; + + } + + /** + * Attempts to make a unique ID out of http request variables. + * This should only be used when storing state in a cookie is impossible. + * + * @return integer + */ + function setEnvGUID() { + + return crc32($this->properties['ua'].$this->properties['ip_address']); + + } +} + ?> \ No newline at end of file diff --git a/modules/base/classes/requestEvent.php b/modules/base/classes/requestEvent.php index 79473f1d6..8ac4c89bb 100644 --- a/modules/base/classes/requestEvent.php +++ b/modules/base/classes/requestEvent.php @@ -83,13 +83,6 @@ function log() { } - function setupNewRequest() { - - $this->bcap = new owa_browscap($this->properties['ua']); - - return; - } - /** * Load request properties from delayed first hit cookie. * @@ -98,21 +91,23 @@ function setupNewRequest() { */ function load_first_hit_properties($properties) { - $this->properties['inbound_first_hit_properties'] = $properties; - $array = explode(",", $properties); - - foreach ($array as $key => $value): - - list($realkey, $realvalue) = split('=>', $value); - $this->properties[$realkey] = $realvalue; - - endforeach; + $this->properties['inbound_first_hit_properties'] = $properties; + + $array = explode(",", $properties); + + foreach ($array as $key => $value): + + list($realkey, $realvalue) = split('=>', $value); + $this->properties[$realkey] = $realvalue; + + endforeach; + // Mark the request to avoid logging it to the first hit cookie again $this->first_hit = true; // Delete first_hit Cookie - setcookie($this->config['ns'].$this->config['first_hit_param'], '', time()-3600*24*365*30, "/", $this->properties['site']); + setcookie($this->config['ns'].$this->config['first_hit_param'], '', time()-3600*24*365*30, "/", $this->config['cookie_domain']); return; } @@ -129,9 +124,9 @@ function load_first_hit_properties($properties) { function log_first_hit() { $values = owa_lib::implode_assoc('=>', ',', $this->properties); - - setcookie($this->config['ns'].$this->config['first_hit_param'], $values, time()+3600*24*365*30, "/", $this->properties['site']); - + //$values = 'test'; + setcookie($this->config['ns'].$this->config['first_hit_param'], $values, time()+3600*24*365*30, "/", $this->config['cookie_domain']); + $this->e->debug('First hit cookie values: '.$values); return true; } @@ -140,14 +135,14 @@ function log_first_hit() { * Assigns visitor IDs * */ - function assign_visitor() { + function assign_visitor($inbound_visitor_id) { // is this new visitor? - if (empty($this->properties['inbound_visitor_id'])): + if (empty($inbound_visitor_id)): $this->set_new_visitor(); else: - $this->properties['visitor_id'] = $this->properties['inbound_visitor_id']; + $this->properties['visitor_id'] = $inbound_visitor_id; $this->properties['is_repeat_visitor'] = true; endif; @@ -158,15 +153,15 @@ function assign_visitor() { * Make Session IDs * */ - function sessionize() { + function sessionize($inbound_session_id) { // check for inbound session id - if (!empty($this->properties['inbound_session_id'])): + if (!empty($inbound_session_id)): if (!empty($this->properties['last_req'])): if ($this->time_since_lastreq < $this->config['session_length']): - $this->properties['session_id'] = $this->properties['inbound_session_id']; + $this->properties['session_id'] = $inbound_session_id; else: //prev session expired, because no hits in half hour. @@ -198,8 +193,11 @@ function create_new_session($visitor_id) { //mark entry page flag on current request $this->properties['is_entry_page'] = true; + //mark new session flag on current request + $this->properties['is_new_session'] = true; + //Set the session cookie - setcookie($this->config['ns'].$this->config['session_param'], $this->properties['session_id'], time()+3600*24*365*30, "/", $this->properties['site']); + setcookie($this->config['ns'].$this->config['session_param'], $this->properties['session_id'], time()+3600*24*365*30, "/", $this->config['cookie_domain']); return; @@ -218,7 +216,7 @@ function set_new_visitor() { $this->properties['visitor_id'] = $this->set_guid(); // Set visitor cookie - setcookie($this->config['ns'].$this->config['visitor_param'], $this->properties['visitor_id'] , time()+3600*24*365*30, "/", $this->properties['site']); + setcookie($this->config['ns'].$this->config['visitor_param'], $this->properties['visitor_id'] , time()+3600*24*365*30, "/", $this->config['cookie_domain']); $this->properties['is_new_visitor'] = true; diff --git a/modules/base/classes/settings.php b/modules/base/classes/settings.php index 03a466309..244d480bb 100644 --- a/modules/base/classes/settings.php +++ b/modules/base/classes/settings.php @@ -47,7 +47,7 @@ class owa_settings { function owa_settings() { $this->config = owa_coreAPI::entityFactory('base.configuration'); - $this->config->set('settings', $this->getDefaultConfig()); + $this->getDefaultConfig(); return; } @@ -84,7 +84,7 @@ function applyModuleOverrides($module, $config) { * @param string id the id of the configuration array to load */ function load($id = 1) { - + if (!file_exists(OWA_BASE_MODULE_DIR.'config'.DIRECTORY_SEPARATOR.'base.php')): $db_config = owa_coreAPI::entityFactory('base.configuration'); @@ -111,7 +111,8 @@ function load($id = 1) { endif; - $this->config->set('id', $id); + $db_id = $db_config->get('id'); + $this->config->set('id', $db_id); else: ; // load config from file @@ -304,7 +305,7 @@ function getDefaultConfig() { 'geolocation_lookup' => true, 'geolocation_service' => 'hostip', 'report_wrapper' => 'wrapper_default.tpl', - 'fetch_config_from_db' => true, + 'do_not_fetch_config_from_db' => false, 'announce_visitors' => false, 'public_url' => '', 'action_url' => '', @@ -335,7 +336,16 @@ function getDefaultConfig() { )); - // Setup special public URLs + $this->config->set('settings', $config); + $this->applyUrls(); + + return; + + } + + function applyUrls() { + + // Setup special public URLs $base_url = "http"; @@ -349,13 +359,16 @@ function getDefaultConfig() { $base_url .= ':'.$_SERVER['SERVER_PORT']; endif; - $config['base']['public_url'] = OWA_PUBLIC_DIR; - $config['base']['main_url'] = $config['base']['public_url']."/main.php"; - $config['base']['main_absolute_url'] = $base_url . $config['base']['main_url']; - $config['base']['action_url'] = $config['base']['main_url']; - $config['base']['images_url'] = $config['base']['public_url']."/i"; - - return $config; + $this->set('base', 'public_url', OWA_PUBLIC_URL); + + $this->set('base', 'main_url', $this->get('base', 'public_url').'/main.php'); + $this->set('base', 'main_absolute_url', $base_url.$this->get('base', 'main_url')); + $this->set('base', 'action_url', $this->get('base', 'main_url')); + $this->set('base', 'images_url', $this->get('base', 'public_url').'/i/'); + $this->set('base', 'images_absolute_url', $base_url.$this->get('base', 'images_url')); + $this->set('base', 'log_url', $this->get('base', 'public_url').'/log.php'); + + return; } diff --git a/modules/base/handlers/requestHandlers.php b/modules/base/handlers/requestHandlers.php index 881cf444d..d50d4c120 100644 --- a/modules/base/handlers/requestHandlers.php +++ b/modules/base/handlers/requestHandlers.php @@ -1,71 +1,75 @@ - - * @copyright Copyright © 2006 Peter Adams - * @license http://www.gnu.org/copyleft/gpl.html GPL v2.0 - * @category owa - * @package owa - * @version $Revision$ - * @since owa 1.0.0 - */ -class owa_requestHandlers extends owa_observer { - - /** - * Constructor - * - * @param string $priority - * @param array $conf - * @access public - * @return Log_observer_request_logger - */ - function owa_requestHandlers() { - - // Call the base class constructor. - - $this->owa_observer(); - - return; - } - - /** - * Notify Handler - * - * @access public - * @param object $event - */ - function notify($event) { - - $this->m = $event['message']; - - switch ($event['event_type']) { - case "base.page_request": - $this->handleEvent('base.logPageRequest'); - break; - - } - - return; - } - -} - -?> + + * @copyright Copyright © 2006 Peter Adams + * @license http://www.gnu.org/copyleft/gpl.html GPL v2.0 + * @category owa + * @package owa + * @version $Revision$ + * @since owa 1.0.0 + */ +class owa_requestHandlers extends owa_observer { + + /** + * Constructor + * + * @param string $priority + * @param array $conf + * @access public + * @return Log_observer_request_logger + */ + function owa_requestHandlers() { + + // Call the base class constructor. + + $this->owa_observer(); + + return; + } + + /** + * Notify Handler + * + * @access public + * @param object $event + */ + function notify($event) { + + $this->m = $event['message']; + $this->handleEvent('base.logPageRequest'); + + /*switch ($event['event_type']) { + case "base.page_request": + $this->handleEvent('base.logPageRequest'); + break; + case "base.first_page_request": + $this->handleEvent('base.logPageRequest'); + break; + + }*/ + + return; + } + +} + +?> diff --git a/modules/base/handlers/sessionHandlers.php b/modules/base/handlers/sessionHandlers.php index 2e8343a70..3a05117d8 100644 --- a/modules/base/handlers/sessionHandlers.php +++ b/modules/base/handlers/sessionHandlers.php @@ -54,13 +54,11 @@ function notify($event) { $this->m = $event['message']; - //print $event['event_type']; - - switch ($event['event_type']) { - case 'base.first_page_request': + switch ($event['message']['is_new_session']) { + case true: $this->handleEvent('base.logSession'); break; - case 'base.page_request': + case false: $this->handleEvent('base.logSessionUpdate'); break; diff --git a/modules/base/kmlVisitsGeolocation.php b/modules/base/kmlVisitsGeolocation.php new file mode 100644 index 000000000..f499325d5 --- /dev/null +++ b/modules/base/kmlVisitsGeolocation.php @@ -0,0 +1,140 @@ + + * @copyright Copyright © 2006 Peter Adams + * @license http://www.gnu.org/copyleft/gpl.html GPL v2.0 + * @category owa + * @package owa + * @version $Revision$ + * @since owa 1.0.0 + */ + +class owa_kmlVisitsGeolocationController extends owa_reportController { + + function owa_kmlVisitsGeolocationController($params) { + + $this->owa_reportController($params); + $this->priviledge_level = 'viewer'; + + return; + } + + function action() { + + // Load the core API + $api = &owa_coreAPI::singleton($this->params); + + $data = array(); + $data['params'] = $this->params; + + //$this->params['period'] = 'last_thirty_days'; + + + if ($this->params['site_id']): + //get site labels + $s = owa_coreAPI::entityFactory('base.site'); + $s->getByColumn('site_id', $this->params['site_id']); + $data['site_name'] = $s->get('name'); + $data['site_description'] = $s->get('description'); + else: + $data['site_name'] = 'All Sites'; + $data['site_description'] = 'All Sites Tracked by OWA'; + endif; + + $data['latest_visits'] = $api->getMetric('base.latestVisits', array( + + 'constraints' => array('site_id' => $this->params['site_id']), + 'limit' => 15, + //'period' => 'last_thirty_days', + 'orderby' => array('session.timestamp'), + 'order' => 'DESC' + + )); + + + + $data['view'] = 'base.kmlVisitsGeolocation'; + + + return $data; + + } + +} + + + +/** + * Visits Geolocation KML View + * + * @author Peter Adams + * @copyright Copyright © 2006 Peter Adams + * @license http://www.gnu.org/copyleft/gpl.html GPL v2.0 + * @category owa + * @package owa + * @version $Revision$ + * @since owa 1.0.0 + */ + +class owa_kmlVisitsGeolocationView extends owa_view { + + function owa_kmlVisitsGeolocationView() { + + $this->owa_view(); + $this->priviledge_level = 'guest'; + + return; + } + + function construct($data) { + + $this->t->set_template('wrapper_blank.tpl'); + + // load body template + $this->body->set_template('kml_visits_geolocation.tpl'); + //$this->body->set_template('kml_google_sample.tpl'); + $this->body->set('visits', $data['latest_visits']); + $this->body->set('site_name', $data['site_name']); + $this->body->set('site_domain', $data['site_domain']); + $this->body->set('site_description', $data['site_description']); + + $this->_setLinkState(); + + $this->body->set('xml', ''); + + header('Content-type: application/vnd.google-earth.kml+xml; charset=UTF-8', true); + //header('Content-type: text/plain', true); + return; + } + + +} + + +?> \ No newline at end of file diff --git a/modules/base/kmlVisitsGeolocationNetworkLink.php b/modules/base/kmlVisitsGeolocationNetworkLink.php new file mode 100644 index 000000000..c140585b5 --- /dev/null +++ b/modules/base/kmlVisitsGeolocationNetworkLink.php @@ -0,0 +1,131 @@ + + * @copyright Copyright © 2006 Peter Adams + * @license http://www.gnu.org/copyleft/gpl.html GPL v2.0 + * @category owa + * @package owa + * @version $Revision$ + * @since owa 1.0.0 + */ + +class owa_kmlVisitsGeolocationNetworkLinkController extends owa_reportController { + + function owa_kmlVisitsGeolocationNetworkLinkController($params) { + + $this->owa_reportController($params); + $this->priviledge_level = 'viewer'; + + return; + } + + function action() { + + // Load the core API + $api = &owa_coreAPI::singleton($this->params); + + $data = array(); + $data['params'] = $this->params; + + if ($this->params['site_id']): + //get site labels + $s = owa_coreAPI::entityFactory('base.site'); + $s->getByColumn('site_id', $this->params['site_id']); + $data['site_name'] = $s->get('name'); + $data['site_description'] = $s->get('description'); + $data['site_domain'] = $s->get('domain'); + else: + $data['site_name'] = 'All Sites'; + $data['site_description'] = 'Visits for all sitess tracked by OWA.'; + $data['site_domain'] = 'owa'; + endif; + + + $data['view'] = 'base.kmlVisitsGeolocationNetworkLink'; + $data['user_name'] = $this->params['u']; + $data['passkey'] = $this->params['pk']; + + return $data; + + } + +} + + + +/** + * Visits Geolocation KML View + * + * @author Peter Adams + * @copyright Copyright © 2006 Peter Adams + * @license http://www.gnu.org/copyleft/gpl.html GPL v2.0 + * @category owa + * @package owa + * @version $Revision$ + * @since owa 1.0.0 + */ + +class owa_kmlVisitsGeolocationNetworkLinkView extends owa_view { + + function owa_kmlVisitsGeolocationNetworkLinkView() { + + $this->owa_view(); + $this->priviledge_level = 'guest'; + + return; + } + + function construct($data) { + + $this->t->set_template('wrapper_blank.tpl'); + + // load body template + $this->body->set_template('kml_network_link_geolocation.tpl'); + $this->body->set('params', $data['params']); + $this->body->set('site_name', $data['site_name']); + $this->body->set('site_domain', $data['site_domain']); + $this->body->set('site_description', $data['site_description']); + $this->body->set('period_label', owa_lib::get_period_label($data['params']['period'])); + $this->body->set('date_label', owa_lib::getDateLabel($data['params']['period'])); + $this->body->set('xml', ''); + $this->body->set('user_name', $data['user_name']); + $this->body->set('passkey', $data['passkey']); + + $this->_setLinkState(); + + header('Content-type: application/vnd.google-earth.kml+xml; charset=UTF-8', true); + //header('Content-type: text/plain', true); + return; + } + + +} + + +?> \ No newline at end of file diff --git a/modules/base/module.php b/modules/base/module.php index ec9b29339..0e3191e5a 100644 --- a/modules/base/module.php +++ b/modules/base/module.php @@ -126,6 +126,13 @@ function registerNavigation() { 'priviledge' => 'viewer', 'anchortext' => 'Feeds', 'order' => 5)); + + $this->addNavigationLink(array('view' => 'base.reportVisitors', + 'nav_name' => 'sub_nav', + 'ref' => 'base.reportVisitsGeolocation', + 'priviledge' => 'viewer', + 'anchortext' => 'Geo-location', + 'order' => 1)); return; diff --git a/modules/base/moduleActivate.php b/modules/base/moduleActivate.php new file mode 100644 index 000000000..682a80045 --- /dev/null +++ b/modules/base/moduleActivate.php @@ -0,0 +1,65 @@ + + * @copyright Copyright © 2006 Peter Adams + * @license http://www.gnu.org/copyleft/gpl.html GPL v2.0 + * @category owa + * @package owa + * @version $Revision$ + * @since owa 1.0.0 + */ + +class owa_moduleActivateController extends owa_controller { + + function owa_moduleActivateController($params) { + $this->owa_controller($params); + $this->priviledge_level = 'admin'; + + return; + } + + function action() { + + $active_modules = $this->c->get('base', 'modules'); + + $active_modules[] = $this->params['module']; + + $this->c->set('base', 'modules', $active_modules); + + $this->c->update(); + + $data = array(); + + $data['do'] = 'base.optionsModules'; + $data['view_method'] = 'redirect'; + $data['status_code'] = 2501; + + return $data; + + } + +} + +?> \ No newline at end of file diff --git a/modules/base/moduleDeactivate.php b/modules/base/moduleDeactivate.php new file mode 100644 index 000000000..a7e118dc3 --- /dev/null +++ b/modules/base/moduleDeactivate.php @@ -0,0 +1,73 @@ + + * @copyright Copyright © 2006 Peter Adams + * @license http://www.gnu.org/copyleft/gpl.html GPL v2.0 + * @category owa + * @package owa + * @version $Revision$ + * @since owa 1.0.0 + */ + +class owa_moduleDeactivateController extends owa_controller { + + function owa_moduleDeactivateController($params) { + $this->owa_controller($params); + $this->priviledge_level = 'admin'; + + return; + } + + function action() { + + $active_modules = $this->c->get('base', 'modules'); + + $new_array = array(); + + foreach ($active_modules as $k => $v){ + if ($v != $this->params['module']): + $new_array[] = $v; + endif; + } + + $this->e->debug('Modules: '.print_r($new_array, true)); + + $this->c->set('base', 'modules', $new_array); + + $this->c->update(); + + $data = array(); + + $data['do'] = 'base.optionsModules'; + $data['view_method'] = 'redirect'; + $data['status_code'] = 2502; + + return $data; + + } + +} + +?> \ No newline at end of file diff --git a/modules/base/options.php b/modules/base/options.php index b4ee01969..cab81507c 100644 --- a/modules/base/options.php +++ b/modules/base/options.php @@ -1,80 +1,83 @@ - - * @copyright Copyright © 2006 Peter Adams - * @license http://www.gnu.org/copyleft/gpl.html GPL v2.0 - * @category owa - * @package owa - * @version $Revision$ - * @since owa 1.0.0 - */ - -class owa_optionsView extends owa_view { - - function owa_OptionsView() { - - $this->owa_view(); - $this->priviledge_level = 'admin'; - $this->default_subview = 'base.optionsGeneral'; - - return; - } - - function construct($data) { - - //page title - $this->t->set('page_title', 'OWA Options'); - - // load body template - $this->body->set_template('options.tpl'); - - // fetch admin links from all modules - // need api call here. - $this->body->set('headline', 'OWA Configuration Options'); - - //Fetch latest OWA news - $rss = new owa_news; - $news = $rss->Get($this->config['owa_rss_url']); - $this->body->set('news', $news); - - // get admin panels - $api = &owa_coreAPI::singleton(); - $panels = $api->getAdminPanels(); - //print_r($panels); - $this->body->set('panels', $panels); - - // Assign config data - $this->body->set('config', $this->config); - - return; - } - - -} - - + + * @copyright Copyright © 2006 Peter Adams + * @license http://www.gnu.org/copyleft/gpl.html GPL v2.0 + * @category owa + * @package owa + * @version $Revision$ + * @since owa 1.0.0 + */ + +class owa_optionsView extends owa_view { + + function owa_OptionsView() { + + $this->owa_view(); + $this->priviledge_level = 'admin'; + $this->default_subview = 'base.optionsGeneral'; + + return; + } + + function construct($data) { + + + + //page title + $this->t->set('page_title', 'OWA Options'); + + // load body template + $this->body->set_template('options.tpl'); + + // fetch admin links from all modules + // need api call here. + $this->body->set('headline', 'OWA Configuration Options'); + + //Fetch latest OWA news + $rss = new owa_news; + //print_r($this->config); + $news = $rss->Get($this->config['owa_rss_url']); + $this->body->set('news', $news); + + // get admin panels + $api = &owa_coreAPI::singleton(); + $panels = $api->getAdminPanels(); + //print_r($panels); + $this->body->set('panels', $panels); + + // Assign config data + $this->body->set('config', $this->config); + + return; + } + + +} + + ?> \ No newline at end of file diff --git a/modules/base/optionsModules.php b/modules/base/optionsModules.php index 02bb472f3..2d31648dd 100644 --- a/modules/base/optionsModules.php +++ b/modules/base/optionsModules.php @@ -63,7 +63,7 @@ function action() { $dirs[$file]['description'] = $mod->description; $dirs[$file]['config_required'] = $mod->config_required; //$dirs['stats'] = lstat($path.$file); - + endif; endif; @@ -86,13 +86,13 @@ function action() { endif; } - $data = array(); - $data['view'] = 'base.options'; - $data['subview'] = 'base.optionsModules'; - $data['view_method'] = 'delegate'; - $data['modules'] = $dirs; + // add data to container + $this->data['view'] = 'base.options'; + $this->data['subview'] = 'base.optionsModules'; + $this->data['view_method'] = 'delegate'; + $this->data['modules'] = $dirs; - return $data; + return $this->data; } @@ -125,11 +125,16 @@ function owa_optionsModulesView($params) { function construct($data) { + + //$this->c->get('base', 'modules')); + // load template $this->body->set_template('options_modules.tpl'); + // fetch admin links from all modules $this->body->set('headline', 'Modules Administration'); + // Assign module data $this->body->set('modules', $data['modules']); return; diff --git a/modules/base/optionsReset.php b/modules/base/optionsReset.php new file mode 100644 index 000000000..65ebb6cc7 --- /dev/null +++ b/modules/base/optionsReset.php @@ -0,0 +1,75 @@ + + * @copyright Copyright © 2006 Peter Adams + * @license http://www.gnu.org/copyleft/gpl.html GPL v2.0 + * @category owa + * @package owa + * @version $Revision$ + * @since owa 1.0.0 + */ + +class owa_optionsResetController extends owa_controller { + + function owa_optionsResetController($params) { + $this->owa_controller($params); + $this->priviledge_level = 'admin'; + + return; + } + + function action() { + + $api = &owa_coreAPI::singleton(); + + $caller_config = $api->caller_config_overrides; + + $default_config = $this->c->getDefaultConfig(); + + // merge the settings with those comming in as params + $nbsettings = array_merge($default_config['base'], $caller_config); + + // place the merge config array back to the global object + $this->c->replace('base', $nbsettings); + + // persist the global config + $this->c->update(); + + $this->e->notice($this->getMsg(2503)); + + $data = array(); + $data['view'] = 'base.options'; + $data['subview'] = 'base.optionsGeneral'; + $data['view_method'] = 'delegate'; + $data['configuration'] = $nbsettings; + $data['status_msg'] = $this->getMsg(2503); + + return $data; + + } + +} + + +?> \ No newline at end of file diff --git a/modules/base/pixel.php b/modules/base/pixel.php index 049658638..ee23e66f7 100644 --- a/modules/base/pixel.php +++ b/modules/base/pixel.php @@ -1,68 +1,68 @@ - - * @copyright Copyright © 2006 Peter Adams - * @license http://www.gnu.org/copyleft/gpl.html GPL v2.0 - * @category owa - * @package owa - * @version $Revision$ - * @since owa 1.0.0 - */ - -class owa_pixelView extends owa_view { - - function owa_pixelView() { - - $this->owa_view(); - $this->priviledge_level = 'guest'; - - return; - } - - function construct($data) { - - // Set Page title - $this->t->set_template('blank.tpl'); - - // load body template - $this->body->set_template('pixel.tpl'); - - $this->body->set('img', sprintf( - '%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%', - 71,73,70,56,57,97,1,0,1,0,128,255,0,192,192,192,0,0,0,33,249,4,1,0,0,0,0,44,0,0,0,0,1,0,1,0,0,2,2,68,1,0,59 - )); - - return; - } - - -} - - + + * @copyright Copyright © 2006 Peter Adams + * @license http://www.gnu.org/copyleft/gpl.html GPL v2.0 + * @category owa + * @package owa + * @version $Revision$ + * @since owa 1.0.0 + */ + +class owa_pixelView extends owa_view { + + function owa_pixelView() { + + $this->owa_view(); + $this->priviledge_level = 'guest'; + + return; + } + + function construct($data) { + + // Set Page title + $this->t->set_template('wrapper_blank.tpl'); + + // load body template + $this->body->set_template('pixel.tpl'); + + $this->body->set('img', sprintf( + '%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%', + 71,73,70,56,57,97,1,0,1,0,128,255,0,192,192,192,0,0,0,33,249,4,1,0,0,0,0,44,0,0,0,0,1,0,1,0,0,2,2,68,1,0,59 + )); + + return; + } + + +} + + ?> \ No newline at end of file diff --git a/modules/base/processEvent.php b/modules/base/processEvent.php index 2a11f45ed..a32e8e155 100644 --- a/modules/base/processEvent.php +++ b/modules/base/processEvent.php @@ -1,83 +1,125 @@ - - * @copyright Copyright © 2006 Peter Adams - * @license http://www.gnu.org/copyleft/gpl.html GPL v2.0 - * @category owa - * @package owa - * @version $Revision$ - * @since owa 1.0.0 - */ - -class owa_processEventController extends owa_controller { - - function owa_processEventController($params) { - $this->owa_controller($params); - $this->priviledge_level = 'guest'; - - return; - } - - /** - * Main Constrol Logic - * - * @return unknown - */ - function action() { - - // Setup generic event model - $event = owa_coreAPI::supportClassFactory('base', 'event'); - - $event->state = $this->params['event']; - - $event->_setProperties($this->params); - - $event->setTime(); - - $event->setIp(); - - // Resolve host name - if ($this->config['resolve_hosts'] = true): - $event->setHost($this->params['REMOTE_HOST']); - endif; - - // sets browser related properties - $event->setBrowser(); - - //Clean Query Strings - if ($this->config['clean_query_strings'] == true): - $event->cleanQueryStrings(); - endif; - - return $event->log(); - - } - -} - - + + * @copyright Copyright © 2006 Peter Adams + * @license http://www.gnu.org/copyleft/gpl.html GPL v2.0 + * @category owa + * @package owa + * @version $Revision$ + * @since owa 1.0.0 + */ + +class owa_processEventController extends owa_controller { + + var $event; + + function owa_processEventController($params) { + + $this->owa_controller($params); + + $this->priviledge_level = 'guest'; + + return; + } + + /** + * Main Constrol Logic + * + * @return unknown + */ + function action() { + + // Setup generic event model + $this->event = owa_coreAPI::supportClassFactory('base', 'event'); + + // Pre process - default and standard properties + $this->pre(); + + $this->event->state = $this->params['event']; + + $this->event->_setProperties($this->params['caller']); + + // Post Process - cleanup after all properties are set + $this->post(); + + return $this->event->log(); + + } + + function pre() { + + // Map standard params to standard event property names + $this->event->properties['inbound_visitor_id'] = $this->params[$this->config['visitor_param']]; + $this->event->properties['inbound_session_id'] = $this->params[$this->config['session_param']]; + $this->event->properties['last_req'] = $this->params[$this->config['last_request_param']]; + $this->event->properties['HTTP_USER_AGENT'] = $this->params['server']['HTTP_USER_AGENT']; + $this->event->properties['HTTP_REFERER'] = $this->params['server']['HTTP_REFERER']; + $this->event->properties['HTTP_HOST'] = $this->params['server']['HTTP_HOST']; + + // Set Ip Address + $this->event->setIp($this->params['server']['HTTP_X_FORWARDED_FOR'], $this->params['server']['HTTP_CLIENT_IP'], $this->params['server']['REMOTE_ADDR']); + + // Set all time related properties + $this->event->setTime($this->params['server']['REQUEST_TIME']); + + // Set host related properties + if ($this->config['resolve_hosts'] = true): + $this->event->setHost($this->params['server']['REMOTE_HOST']); + endif; + + // Browser related properties + $this->event->properties['browser_type'] = $this->params['browscap']['Browser']; + $this->event->properties['browser'] = $this->params['server']['Browser'] . ' ' . $this->params['browscap']['Version']; + + // Set Operating System + $this->event->setOs($this->params['browscap']['Platform']); + + return; + + + } + + function post() { + + //Clean Query Strings + if ($this->config['clean_query_strings'] == true): + $this->event->cleanQueryStrings(); + endif; + + // set site id if not already set + if (empty($this->params['caller']['site_id'])): + $this->event->properties['site_id'] = $this->config['site_id']; + endif; + + return; + + } + +} + + ?> \ No newline at end of file diff --git a/modules/base/processFirstRequest.php b/modules/base/processFirstRequest.php index 868d581e8..a7ef6313f 100644 --- a/modules/base/processFirstRequest.php +++ b/modules/base/processFirstRequest.php @@ -19,6 +19,7 @@ require_once(OWA_BASE_DIR.'/owa_lib.php'); require_once(OWA_BASE_DIR.'/owa_controller.php'); +require_once(OWA_BASE_MODULE_DIR.'processEvent.php'); /** * Controller @@ -32,10 +33,10 @@ * @since owa 1.0.0 */ -class owa_processFirstRequestController extends owa_controller { +class owa_processFirstRequestController extends owa_processEventController { function owa_processFirstRequestController($params) { - $this->owa_controller($params); + $this->owa_processEventController($params); $this->priviledge_level = 'guest'; } @@ -44,20 +45,20 @@ function action() { if (!empty($this->params[$this->config['first_hit_param']])): // Create a new request object - $r = owa_coreAPI::supportClassFactory('base', 'requestEvent'); + $this->event = owa_coreAPI::supportClassFactory('base', 'requestEvent'); - $r->state = 'first_page_request'; + $this->event->state = 'first_page_request'; //Load request properties from first_hit cookie if it exists if (!empty($this->params[$this->config['first_hit_param']])): - $r->load_first_hit_properties($this->params[$this->config['first_hit_param']]); + $this->event->load_first_hit_properties($this->params[$this->config['first_hit_param']]); endif; $this->e->debug(sprintf('First hit Request %d logged to event queue', $r->properties['request_id'])); // Log the request - $r->log(); + $this->event->log(); endif; diff --git a/modules/base/processRequest.php b/modules/base/processRequest.php index 00fb3d053..be7625aa8 100644 --- a/modules/base/processRequest.php +++ b/modules/base/processRequest.php @@ -1,132 +1,122 @@ - - * @copyright Copyright © 2006 Peter Adams - * @license http://www.gnu.org/copyleft/gpl.html GPL v2.0 - * @category owa - * @package owa - * @version $Revision$ - * @since owa 1.0.0 - */ - -class owa_processRequestController extends owa_controller { - - - var $bcap; // browscap - - function owa_processRequestController($params) { - $this->owa_controller($params); - $this->priviledge_level = 'guest'; - } - - function action() { - - // Control logic - - // Do not log if the first_hit cookie is still present. - if (!empty($this->params[$this->config['first_hit_param']])): - return; - endif; - - // Setup request event - $r = owa_coreAPI::supportClassFactory('base', 'requestEvent'); - - // Set event properties - $r->_setProperties($this->params); - - // set site id if not already set - if (empty($this->params['site_id'])): - $r->properties['site_id'] = $this->config['site_id']; - endif; - - // Set Ip Address - $r->setIp(); - - // Set all time related properties - $r->setTime(); - - // Set Operating System - $r->setOs($this->params['browscap_Platform']); - - // Set host related properties - if ($this->config['resolve_hosts'] = true): - $r->setHost($this->params['REMOTE_HOST']); - endif; - - // sets browser related properties NEEDED? - $r->setBrowser(); - - // Set the uri or else construct it from environmental vars - if (empty($this->params['page_url'])): - $r->properties['page_url'] = owa_lib::get_current_url(); - endif; - - $r->properties['inbound_page_url'] = $r->properties['page_url']; - - // Strip session based URL params - $r->properties['page_url'] = $r->stripDocumentUrl($r->properties['page_url']); - - // Feed subscription tracking code - $r->properties['feed_subscription_id'] = $this->params[$this->config['feed_subscription_param']]; - - // Traffic Source code - $r->properties['source'] = $this->params[$this->config['source_param']]; - - //Check for what kind of page request this is - if ($this->params['browscap_Crawler'] == true): - $r->is_robot = true; - $r->properties['is_robot'] = true; - $r->properties['is_browser'] = false; - $r->state = 'robot_request'; - elseif ($r->properties['is_feedreader'] == true || $this->params['browscap_isSyndicationReader'] == true): $r->properties['is_feedreader'] == true; - $r->properties['is_browser'] = false; - $r->properties['feed_reader_guid'] = $r->setEnvGUID(); - $r->state = 'feed_request'; - else: - $r->state = 'page_request'; - $r->properties['is_browser'] = true; - $r->assign_visitor(); - $r->sessionize(); - endif; - - //update last-request time cookie - setcookie($this->config['ns'].$this->config['last_request_param'], - $r->properties['sec'], - time()+3600*24*365*30, - "/", - $r->setCookieDomain($this->params['HTTP_HOST'])); - - return $r->log(); - - } - - - -} - - + + * @copyright Copyright © 2006 Peter Adams + * @license http://www.gnu.org/copyleft/gpl.html GPL v2.0 + * @category owa + * @package owa + * @version $Revision$ + * @since owa 1.0.0 + */ + +class owa_processRequestController extends owa_processEventController { + + function owa_processRequestController($params) { + + $this->owa_processEventController($params); + + $this->priviledge_level = 'guest'; + + return; + } + + function action() { + + // Control logic + + // Do not log if the first_hit cookie is still present. + if (!empty($this->params[$this->config['first_hit_param']])): + return; + endif; + + // Setup request event + $this->event = owa_coreAPI::supportClassFactory('base', 'requestEvent'); + + // Pre process - set default and standard event property names + $this->pre(); + + // Set event properties + $this->event->_setProperties($this->params['caller']); + + // set page type to unknown if not already set by caller + if (empty($this->params['caller']['page_type'])): + $this->event->properties['page_type'] = $this->getMsg(3600); + endif; + + // Set the uri or else construct it from environmental vars + if (empty($this->params['caller']['page_url'])): + $this->event->properties['page_url'] = owa_lib::get_current_url(); + endif; + + $this->event->properties['inbound_page_url'] = $this->event->properties['page_url']; + + // Feed subscription tracking code + $this->event->properties['feed_subscription_id'] = $this->params['caller'][$this->config['feed_subscription_param']]; + + // Traffic Source code + $this->event->properties['source'] = $this->params['caller'][$this->config['source_param']]; + + //Check for what kind of page request this is + if ($this->params['browscap']['Crawler'] == true): + $this->event->is_robot = true; + $this->event->properties['is_robot'] = true; + $this->event->properties['is_browser'] = false; + $this->event->state = 'robot_request'; + elseif ($this->event->params['caller']['is_feedreader'] == true || $this->params['browscap']['isSyndicationReader'] == true): + $this->event->properties['is_feedreader'] == true; + $this->event->properties['is_browser'] = false; + $this->event->properties['is_feedreader'] = true; + $this->event->properties['feed_reader_guid'] = $this->event->setEnvGUID(); + $this->event->state = 'feed_request'; + else: + $this->event->state = 'page_request'; + $this->event->properties['is_browser'] = true; + $this->event->assign_visitor($this->event->properties['inbound_visitor_id']); + $this->event->sessionize($this->event->properties['inbound_session_id']); + endif; + + //update last-request time cookie + setcookie($this->config['ns'].$this->config['last_request_param'], + $this->event->properties['sec'], + time()+3600*24*365*30, + "/", + $this->config['cookie_domain']); + + // Post Process - cleanup after all properties are set + $this->post(); + + return $this->event->log(); + + } + + + +} + + ?> \ No newline at end of file diff --git a/modules/base/report.php b/modules/base/report.php index b7d4dce65..7714e79ed 100644 --- a/modules/base/report.php +++ b/modules/base/report.php @@ -46,8 +46,6 @@ function owa_reportView() { function construct($data) { - - // Set Page title $this->t->set('page_title', 'Report'); @@ -96,6 +94,7 @@ function construct($data) { $this->body->caller_params['link_state'] = $link_params; $this->subview->body->caller_params['link_state'] = $link_params; + // set site filter list $this->body->set('sites', $this->getSitesList()); @@ -107,12 +106,14 @@ function construct($data) { $this->body->set('news', $news); + // Set navigation $api = &owa_coreAPI::singleton(); - $data['nav'] = $api->getNavigation('base.report', 'top_level_report_nav'); - - $this->body->set('top_level_report_nav', $data['nav']); + + $this->body->set('sub_nav', $api->getNavigation($this->data['nav_tab'], 'sub_nav')); + $this->body->set('top_level_report_nav', $api->getNavigation('base.report', 'top_level_report_nav')); // load body template + $this->body->set_template('report.tpl'); return; diff --git a/modules/base/reportDocument.php b/modules/base/reportDocument.php index 9298ae206..6054b012a 100644 --- a/modules/base/reportDocument.php +++ b/modules/base/reportDocument.php @@ -106,6 +106,7 @@ function action() { $data['view'] = 'base.report'; $data['subview'] = 'base.reportDocument'; + $data['nav_tab'] = 'base.reportContent'; return $data; diff --git a/modules/base/reportVisit.php b/modules/base/reportVisit.php index 3ef0a098d..ae0f4767c 100644 --- a/modules/base/reportVisit.php +++ b/modules/base/reportVisit.php @@ -76,6 +76,7 @@ function action() { $data['view'] = 'base.report'; $data['subview'] = 'base.reportVisit'; + $data['nav_tab'] = 'base.reportVisitors'; return $data; diff --git a/modules/base/reportVisitor.php b/modules/base/reportVisitor.php index f2460af1c..6a725e2db 100644 --- a/modules/base/reportVisitor.php +++ b/modules/base/reportVisitor.php @@ -61,6 +61,7 @@ function action() { $data['view'] = 'base.report'; $data['subview'] = 'base.reportVisitor'; + $data['nav_tab'] = 'base.reportVisitors'; return $data; diff --git a/modules/base/reportVisitors.php b/modules/base/reportVisitors.php index f1751e4a9..014a3f212 100644 --- a/modules/base/reportVisitors.php +++ b/modules/base/reportVisitors.php @@ -39,6 +39,8 @@ function owa_reportVisitorsController($params) { $this->owa_reportController($params); $this->priviledge_level = 'viewer'; + //print_r($this->config); + return; } @@ -58,7 +60,8 @@ function action() { )); //print_r($data['visitors_age']); - + //$data['sub_nav'] = $api->getNavigation('base.reportVisitors', 'sub_nav'); + $data['nav_tab'] = 'base.reportVisitors'; $data['view'] = 'base.report'; $data['subview'] = 'base.reportVisitors'; @@ -99,7 +102,8 @@ function construct($data) { $this->body->set('headline', 'Visitors Report'); $this->body->set('visitors_age', $data['visitors_age']); - + $this->body->set('sub_nav', $data['sub_nav']); + return; } diff --git a/modules/base/reportVisitsGeolocation.php b/modules/base/reportVisitsGeolocation.php new file mode 100644 index 000000000..18fbe77b2 --- /dev/null +++ b/modules/base/reportVisitsGeolocation.php @@ -0,0 +1,109 @@ + + * @copyright Copyright © 2006 Peter Adams + * @license http://www.gnu.org/copyleft/gpl.html GPL v2.0 + * @category owa + * @package owa + * @version $Revision$ + * @since owa 1.0.0 + */ + +class owa_reportVisitsGeolocationController extends owa_reportController { + + function owa_reportVisitsGeolocationController($params) { + + $this->owa_reportController($params); + $this->priviledge_level = 'viewer'; + + return; + } + + function action() { + + // Load the core API + $api = &owa_coreAPI::singleton($this->params); + + $data = array(); + $data['params'] = $this->params; + + $data['nav_tab'] = 'base.reportVisitors'; + $data['view'] = 'base.report'; + $data['subview'] = 'base.reportVisitsGeolocation'; + $data['user_name'] = $this->params['u']; + + //perfrom authentication + $auth = &owa_auth::get_instance(); + + $data['passkey'] = $auth->generateUrlPasskey($this->params['u'], $this->params['p']); + + return $data; + + + } + +} + + +/** + * Visits Geolocation Report View + * + * @author Peter Adams + * @copyright Copyright © 2006 Peter Adams + * @license http://www.gnu.org/copyleft/gpl.html GPL v2.0 + * @category owa + * @package owa + * @version $Revision$ + * @since owa 1.0.0 + */ + +class owa_reportVisitsGeolocationView extends owa_view { + + function owa_reportVisitsGeolocationView() { + + $this->owa_view(); + $this->priviledge_level = 'guest'; + + return; + } + + function construct($data) { + + // Assign data to templates + + $this->body->set_template('report_geolocation.tpl'); + $this->body->set('headline', 'Visitor Geolocation Report'); + $this->body->set('user_name', $data['user_name']); + $this->body->set('passkey', $data['passkey']); + + return; + } + + +} + + +?> \ No newline at end of file diff --git a/modules/base/sitesEdit.php b/modules/base/sitesEdit.php index a405fc05a..2f7ef1d0a 100644 --- a/modules/base/sitesEdit.php +++ b/modules/base/sitesEdit.php @@ -19,7 +19,6 @@ require_once(OWA_BASE_DIR.'/owa_lib.php'); require_once(OWA_BASE_DIR.'/owa_view.php'); require_once(OWA_BASE_DIR.'/owa_controller.php'); -require_once(OWA_BASE_DIR.'/owa_site.php'); /** * Edit Sites View @@ -57,9 +56,9 @@ function construct($data) { if ($data['sites']): $this->body->set('site', $data['site']); else: - $site = new owa_site; - $site->getSiteByPK($data['site_id']); - $this->body->set('site', get_object_vars($site)); + $site = owa_coreAPI::entityFactory('base.site'); + $site->getByColumn('site_id', $data['site_id']); + $this->body->set('site', $site->_getProperties()); endif; diff --git a/modules/base/templates/css.tpl b/modules/base/templates/css.tpl index 3bedb024f..21a1614af 100644 --- a/modules/base/templates/css.tpl +++ b/modules/base/templates/css.tpl @@ -1,11 +1,12 @@ \ No newline at end of file diff --git a/modules/base/templates/header.tpl b/modules/base/templates/header.tpl index ebe12f02b..653abb5c4 100644 --- a/modules/base/templates/header.tpl +++ b/modules/base/templates/header.tpl @@ -1,26 +1,29 @@ - - - - - -

Open Web Analytics

-
- - - - - - - - - - -
Admin Options|Help|Bug Report| - - Logout - - Login - -
-
-
\ No newline at end of file + + + + + + +

Open Web Analytics

+
+ + + + + + + + + + + + +
Web Analytics|Admin Options|Help|Bug Report| + + Logout + + Login + +
+
+
diff --git a/modules/base/templates/js_log_lib.tpl b/modules/base/templates/js_log_lib.tpl index e5d331dfe..29b78859a 100644 --- a/modules/base/templates/js_log_lib.tpl +++ b/modules/base/templates/js_log_lib.tpl @@ -1,419 +1,419 @@ -// -// Open Web Analytics - An Open Source Web Analytics Framework -// -// Copyright 2006 Peter Adams. All rights reserved. -// -// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// $Id$ -// - -/** - * Javascript Tracking Library - * - * @author Peter Adams - * @copyright Copyright © 2006 Peter Adams - * @license http://www.gnu.org/copyleft/gpl.html GPL v2.0 - * @category owa - * @package owa - * @version $Revision$ - * @since owa 1.0.0 - */ - -var OWA = {} - -OWA.log = function() { - - this.id = ''; -} - -OWA.log.prototype = { - - // private method for issuing logging request - _makeAjaxRequest : function (properties) { - - var bug - var get - var init - - url = this._assembleRequestUrl(properties); - - if (window.XMLHttpRequest){ - - // If IE7, Mozilla, Safari, etc: Use native object - var ajax = new XMLHttpRequest() - - } - - else { - - if (window.ActiveXObject){ - - // ...otherwise, use the ActiveX control for IE5.x and IE6 - var ajax = new ActiveXObject("Microsoft.XMLHTTP"); - } - - } - - - ajax.open("GET", url, false); - ajax.send(null); - - // Uninitialize variable. - init = null; - - return; - }, - - // private method for issuing logging request - _makeRequest : function (properties) { - - var bug - var url - - url = this._assembleRequestUrl(properties); - - bug = ""; - - document.write(bug); - - return; - }, - - _assembleRequestUrl : function(properties) { - - var get - var log_url - - get = ''; - - log_url = 'makeAbsoluteLink('', $this->config['log_url']);?>'; - - //assemble query string - for(param in properties) { // print out the params - - - value = ''; - - if (typeof properties[param] != 'undefined') { - - value = Url.encode(this._base64_encode(properties[param]+'')); - - }else { - - value = ''; - - } - - get = get + "owa_" + param + "=" + value + "&"; - } - - // add some radomness for cache busting - return log_url + get + Math.round(100*Math.random()); - - }, - - _base64_encode : function(decStr) { - - var base64s = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; - var bits; - var dual; - var i = 0; - var encOut = ''; - - while(decStr.length >= i + 3) { - bits = (decStr.charCodeAt(i++) & 0xff) <<16 | - (decStr.charCodeAt(i++) & 0xff) <<8 | - decStr.charCodeAt(i++) & 0xff; - - encOut += base64s.charAt((bits & 0x00fc0000) >>18) + - base64s.charAt((bits & 0x0003f000) >>12) + - base64s.charAt((bits & 0x00000fc0) >> 6) + - base64s.charAt((bits & 0x0000003f)); - } - - if(decStr.length -i > 0 && decStr.length -i < 3) { - dual = Boolean(decStr.length -i -1); - - bits = ((decStr.charCodeAt(i++) & 0xff) <<16) | - (dual ? (decStr.charCodeAt(i) & 0xff) <<8 : 0); - - encOut += base64s.charAt((bits & 0x00fc0000) >>18) + - base64s.charAt((bits & 0x0003f000) >>12) + - (dual ? base64s.charAt((bits & 0x00000fc0) >>6) : '=') + - '='; - } - - return(encOut); - } - -} - -// OWA Page View object ///////////////////////////////////// - -OWA.pageView = function(caller_params) { - - this.properties = new Object(); - - for(param in caller_params) { // print out the params - - this.properties[param] = caller_params[param]; - - } - - this._setProperties(); - - return; -}; - -OWA.pageView.prototype = { - - // public method for setting logging request properties - _setProperties : function () { - - this.properties["event"] = "base.page_request"; - this.properties["action"] = "base.processRequest"; - - if (typeof this.properties["page_uri"] == 'undefined') { - this.properties["page_url"] = document.URL; - } - if (typeof this.properties["page_title"] == 'undefined') { - this.properties["page_title"] = document.title; - } - - if (typeof this.properties["referer"] == 'undefined') { - this.properties["referer"] = document.referer; - } - - return; - }, - - log : function() { - - logger = new OWA.log; - return logger._makeRequest(this.properties); - - }, - -} - - - -// OWA click object ///////////////////////////////////////// - -/** - * Constructor of the click object - * - * @param e Event Object - */ -OWA.click = function(caller_params) { - - this.properties = new Object(); - - for(param in caller_params) { // print out the params - - this.properties[param] = caller_params[param]; - - } - - this.e = ''; - - return; - -}; - -OWA.click.prototype = { - - properties : new Object, - - e : '', - - init: 0, - - - /** - * Sets all properties of the click object - * - * @param e Event Object - */ - setProperties : function(e) { - - - this.e = e; - this.properties["event"] = "base.click"; - this.properties["action"] = "base.processEvent"; - this._setTarget(); - this._setTagName(); - this._setCoords(); - this.properties["dom_element_name"] = this.targ.name; - this.properties["dom_element_value"] = this.targ.value; - this.properties["dom_element_id"] = this.targ.id; - this.properties["page_url"] = window.location.href; - this.init = 1; - - return true; - }, - - log : function() { - - //alert(this.properties["site_id"]); - //alert("hello from click.log"); - - if (this.init == 1) { - - var logger - - logger = new OWA.log; - logger._makeAjaxRequest(this.properties); - } - - this.init = 0; - return; - - }, - - /** - * Sets coordinates of where in the browser the user clicked - * - */ - _setCoords : function() { - - var windowWidth = window.innerWidth ? window.innerWidth : document.body.offsetWidth; - var windowHeight = window.innerHeight ? window.innerHeight : document.body.offsetHeight; - - if( typeof( this.e.pageX ) == 'number' ) { - - this.properties["click_x"] = this.e.pageX + ''; - this.properties["click_y"] = this.e.pageY + ''; - } - else { - - this.properties["click_x"] = this.e.clientX + ''; - this.properties["click_y"] = this.e.clientY + ''; - } - - this.properties["dom_element_x"] = this._findPosX(this.targ) + ''; - this.properties["dom_element_y"] = this._findPosY(this.targ) + ''; - this.properties["page_width"] = windowWidth + ''; - this.properties["page_height"] = windowHeight + ''; - - return; - }, - - /** - * Sets the X coordinate of where in the browser the user clicked - * - */ - _findPosX : function(obj) { - - var curleft = 0; - if (obj.offsetParent) - { - while (obj.offsetParent) - { - curleft += obj.offsetLeft - obj = obj.offsetParent; - } - } - else if (obj.x) - curleft += obj.x; - return curleft; - }, - - /** - * Sets the Y coordinates of where in the browser the user clicked - * - */ - _findPosY : function(obj) { - - var curtop = 0; - if (obj.offsetParent) - { - while (obj.offsetParent) - { - curtop += obj.offsetTop - obj = obj.offsetParent; - } - } - else if (obj.y) - curtop += obj.y; - return curtop; - }, - - /** - * Sets the HTML element that actually generated the event - * - */ - _setTarget : function() { - - // Determine the actual html element that generated the event - if (this.e.target) { - this.targ = this.e.target; - - } else if (this.e.srcElement) { - this.targ = this.e.srcElement; - } - - if (this.targ.nodeType == 3) { - // defeat Safari bug - this.targ = target.parentNode; - } - - return; - }, - - /** - * Sets the tag name of html eleemnt that generated the event - */ - _setTagName : function() { - - // Set properties of the owa_click object. - this.properties["dom_element_tag"] = this.targ.tagName; - - if (this.properties["dom_element_tag"] == "A") { - - if (this.targ.textContent != undefined) { - this.properties["dom_element_text"] = this.targ.textContent; - } else { - this.properties["dom_element_text"] = this.targ.innerText; - } - - this.properties["target_url"] = this.targ.href; - - } - else if (this.properties["dom_element_tag"] == "INPUT") { - - this.properties["dom_element_text"] = this.targ.value; - } - - else if (this.properties["html_element_tag"] == "IMG") { - - this.properties["target_url"] = this.targ.parentNode.href; - this.properties["dom_element_text"] = this.targ.alt; - } - - else { - - this.properties["target_url"] = this.targ.parentNode.href; - - if (this.targ.textContent != undefined) { - this.properties["html_element_text"] = this.targ.textContent; - } else { - this.properties["html_element_text"] = this.targ.innerText; - } - } - - return; - }, - -} - - - - +// +// Open Web Analytics - An Open Source Web Analytics Framework +// +// Copyright 2006 Peter Adams. All rights reserved. +// +// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// $Id$ +// + +/** + * Javascript Tracking Library + * + * @author Peter Adams + * @copyright Copyright © 2006 Peter Adams + * @license http://www.gnu.org/copyleft/gpl.html GPL v2.0 + * @category owa + * @package owa + * @version $Revision$ + * @since owa 1.0.0 + */ + +var OWA = {} + +OWA.log = function() { + + this.id = ''; +} + +OWA.log.prototype = { + + // private method for issuing logging request + _makeAjaxRequest : function (properties) { + + var bug + var get + var init + + url = this._assembleRequestUrl(properties); + + if (window.XMLHttpRequest){ + + // If IE7, Mozilla, Safari, etc: Use native object + var ajax = new XMLHttpRequest() + + } + + else { + + if (window.ActiveXObject){ + + // ...otherwise, use the ActiveX control for IE5.x and IE6 + var ajax = new ActiveXObject("Microsoft.XMLHTTP"); + } + + } + + + ajax.open("GET", url, false); + ajax.send(null); + + // Uninitialize variable. + init = null; + + return; + }, + + // private method for issuing logging request + _makeRequest : function (properties) { + + var bug + var url + + url = this._assembleRequestUrl(properties); + + bug = ""; + + document.write(bug); + + return; + }, + + _assembleRequestUrl : function(properties) { + + var get + var log_url + + get = ''; + + log_url = 'makeAbsoluteLink('', false, $this->config['log_url']);?>'; + + //assemble query string + for(param in properties) { // print out the params + + + value = ''; + + if (typeof properties[param] != 'undefined') { + + value = Url.encode(this._base64_encode(properties[param]+'')); + + }else { + + value = ''; + + } + + get = get + "owa_" + param + "=" + value + "&"; + } + + // add some radomness for cache busting + return log_url + get + Math.round(100*Math.random()); + + }, + + _base64_encode : function(decStr) { + + var base64s = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; + var bits; + var dual; + var i = 0; + var encOut = ''; + + while(decStr.length >= i + 3) { + bits = (decStr.charCodeAt(i++) & 0xff) <<16 | + (decStr.charCodeAt(i++) & 0xff) <<8 | + decStr.charCodeAt(i++) & 0xff; + + encOut += base64s.charAt((bits & 0x00fc0000) >>18) + + base64s.charAt((bits & 0x0003f000) >>12) + + base64s.charAt((bits & 0x00000fc0) >> 6) + + base64s.charAt((bits & 0x0000003f)); + } + + if(decStr.length -i > 0 && decStr.length -i < 3) { + dual = Boolean(decStr.length -i -1); + + bits = ((decStr.charCodeAt(i++) & 0xff) <<16) | + (dual ? (decStr.charCodeAt(i) & 0xff) <<8 : 0); + + encOut += base64s.charAt((bits & 0x00fc0000) >>18) + + base64s.charAt((bits & 0x0003f000) >>12) + + (dual ? base64s.charAt((bits & 0x00000fc0) >>6) : '=') + + '='; + } + + return(encOut); + } + +} + +// OWA Page View object ///////////////////////////////////// + +OWA.pageView = function(caller_params) { + + this.properties = new Object(); + + for(param in caller_params) { // print out the params + + this.properties[param] = caller_params[param]; + + } + + this._setProperties(); + + return; +}; + +OWA.pageView.prototype = { + + // public method for setting logging request properties + _setProperties : function () { + + this.properties["event"] = "base.page_request"; + this.properties["action"] = "base.processRequest"; + + if (typeof this.properties["page_uri"] == 'undefined') { + this.properties["page_url"] = document.URL; + } + if (typeof this.properties["page_title"] == 'undefined') { + this.properties["page_title"] = document.title; + } + + if (typeof this.properties["referer"] == 'undefined') { + this.properties["referer"] = document.referer; + } + + return; + }, + + log : function() { + + logger = new OWA.log; + return logger._makeRequest(this.properties); + + }, + +} + + + +// OWA click object ///////////////////////////////////////// + +/** + * Constructor of the click object + * + * @param e Event Object + */ +OWA.click = function(caller_params) { + + this.properties = new Object(); + + for(param in caller_params) { // print out the params + + this.properties[param] = caller_params[param]; + + } + + this.e = ''; + + return; + +}; + +OWA.click.prototype = { + + properties : new Object, + + e : '', + + init: 0, + + + /** + * Sets all properties of the click object + * + * @param e Event Object + */ + setProperties : function(e) { + + + this.e = e; + this.properties["event"] = "base.click"; + this.properties["action"] = "base.processEvent"; + this._setTarget(); + this._setTagName(); + this._setCoords(); + this.properties["dom_element_name"] = this.targ.name; + this.properties["dom_element_value"] = this.targ.value; + this.properties["dom_element_id"] = this.targ.id; + this.properties["page_url"] = window.location.href; + this.init = 1; + + return true; + }, + + log : function() { + + //alert(this.properties["site_id"]); + //alert("hello from click.log"); + + if (this.init == 1) { + + var logger + + logger = new OWA.log; + logger._makeAjaxRequest(this.properties); + } + + this.init = 0; + return; + + }, + + /** + * Sets coordinates of where in the browser the user clicked + * + */ + _setCoords : function() { + + var windowWidth = window.innerWidth ? window.innerWidth : document.body.offsetWidth; + var windowHeight = window.innerHeight ? window.innerHeight : document.body.offsetHeight; + + if( typeof( this.e.pageX ) == 'number' ) { + + this.properties["click_x"] = this.e.pageX + ''; + this.properties["click_y"] = this.e.pageY + ''; + } + else { + + this.properties["click_x"] = this.e.clientX + ''; + this.properties["click_y"] = this.e.clientY + ''; + } + + this.properties["dom_element_x"] = this._findPosX(this.targ) + ''; + this.properties["dom_element_y"] = this._findPosY(this.targ) + ''; + this.properties["page_width"] = windowWidth + ''; + this.properties["page_height"] = windowHeight + ''; + + return; + }, + + /** + * Sets the X coordinate of where in the browser the user clicked + * + */ + _findPosX : function(obj) { + + var curleft = 0; + if (obj.offsetParent) + { + while (obj.offsetParent) + { + curleft += obj.offsetLeft + obj = obj.offsetParent; + } + } + else if (obj.x) + curleft += obj.x; + return curleft; + }, + + /** + * Sets the Y coordinates of where in the browser the user clicked + * + */ + _findPosY : function(obj) { + + var curtop = 0; + if (obj.offsetParent) + { + while (obj.offsetParent) + { + curtop += obj.offsetTop + obj = obj.offsetParent; + } + } + else if (obj.y) + curtop += obj.y; + return curtop; + }, + + /** + * Sets the HTML element that actually generated the event + * + */ + _setTarget : function() { + + // Determine the actual html element that generated the event + if (this.e.target) { + this.targ = this.e.target; + + } else if (this.e.srcElement) { + this.targ = this.e.srcElement; + } + + if (this.targ.nodeType == 3) { + // defeat Safari bug + this.targ = target.parentNode; + } + + return; + }, + + /** + * Sets the tag name of html eleemnt that generated the event + */ + _setTagName : function() { + + // Set properties of the owa_click object. + this.properties["dom_element_tag"] = this.targ.tagName; + + if (this.properties["dom_element_tag"] == "A") { + + if (this.targ.textContent != undefined) { + this.properties["dom_element_text"] = this.targ.textContent; + } else { + this.properties["dom_element_text"] = this.targ.innerText; + } + + this.properties["target_url"] = this.targ.href; + + } + else if (this.properties["dom_element_tag"] == "INPUT") { + + this.properties["dom_element_text"] = this.targ.value; + } + + else if (this.properties["html_element_tag"] == "IMG") { + + this.properties["target_url"] = this.targ.parentNode.href; + this.properties["dom_element_text"] = this.targ.alt; + } + + else { + + this.properties["target_url"] = this.targ.parentNode.href; + + if (this.targ.textContent != undefined) { + this.properties["html_element_text"] = this.targ.textContent; + } else { + this.properties["html_element_text"] = this.targ.innerText; + } + } + + return; + }, + +} + + + + diff --git a/modules/base/templates/kml_network_link_geolocation.tpl b/modules/base/templates/kml_network_link_geolocation.tpl new file mode 100644 index 000000000..b4b9d0e8a --- /dev/null +++ b/modules/base/templates/kml_network_link_geolocation.tpl @@ -0,0 +1,21 @@ + + + + + Open Web Analytics Links + 1 + 1 + These are network links for OWA. + + + 1 + 0 + Visits for + 0 + 1 + + makeAbsoluteLink(array('do' => 'base.kmlVisitsGeolocation', 'rand' => rand()), true, '', true);?> + + + + \ No newline at end of file diff --git a/modules/base/templates/kml_visits_geolocation.tpl b/modules/base/templates/kml_visits_geolocation.tpl new file mode 100644 index 000000000..c6c6a8004 --- /dev/null +++ b/modules/base/templates/kml_visits_geolocation.tpl @@ -0,0 +1,19 @@ + + + + + Where does this show up? + + + + - / at : + ]]> + + ,,5000 + + #defaultStyle + + + + + \ No newline at end of file diff --git a/modules/base/templates/options.tpl b/modules/base/templates/options.tpl index e051654c0..68c2a0b80 100644 --- a/modules/base/templates/options.tpl +++ b/modules/base/templates/options.tpl @@ -1,4 +1,4 @@ - +
News @@ -38,3 +38,4 @@ +
\ No newline at end of file diff --git a/modules/base/templates/options_general.tpl b/modules/base/templates/options_general.tpl index 5a5cd19b7..3e28b1531 100644 --- a/modules/base/templates/options_general.tpl +++ b/modules/base/templates/options_general.tpl @@ -1,184 +1,191 @@ -
-
-
- -
- Request Processing Options - -
- Resolve Host Names: - -
- -
- Log Requests from Feed Readers: - -
- -
- Log Requests from Known Robots: - -
- -
- Announce New Visitors via E-mail: - -
- -
- - Notice Email Address:
- -
- -
- -
- -
- Geo-location - -
- - Perform Geo-location Lookup: - -
-
- Geolocation Service: - - -
- -
- - -
- -
- Event Handling - - - -
- Asynchronous Event Handling Mode: - -
- -
- - Event Log File Directory:
- -
- -
- - Event Log File Name:
- -
- -
- -
- -
- Error Logging - -
- Logging Mode: - - -
- -
- -
- -
- Reporting - -
- - Reporting Wrapper:
- -
- -
- -
- - - - - -
+
+
+
+ +
+ Request Processing Options + +
+ Resolve Host Names: + +
+ +
+ Log Requests from Feed Readers: + +
+ +
+ Log Requests from Known Robots: + +
+ +
+ Announce New Visitors via E-mail: + +
+ +
+ + Notice Email Address:
+ +
+ +
+ +
+ +
+ Geo-location + +
+ + Perform Geo-location Lookup: + +
+
+ Geolocation Service: + + +
+ +
+ + Google Maps API Key:
+ + +
+ +
+ + +
+ +
+ Event Handling + + + +
+ Asynchronous Event Handling Mode: + +
+ +
+ + Event Log File Directory:
+ +
+ +
+ + Event Log File Name:
+ +
+ +
+ +
+ +
+ Error Logging + +
+ Logging Mode: + + +
+ +
+ +
+ +
+ Reporting + +
+ + Reporting Wrapper:
+ +
+ +
+ +
+ + + + + +
\ No newline at end of file diff --git a/modules/base/templates/options_modules.tpl b/modules/base/templates/options_modules.tpl index 392fb9384..f8bf74a21 100644 --- a/modules/base/templates/options_modules.tpl +++ b/modules/base/templates/options_modules.tpl @@ -20,7 +20,7 @@ - Deactivate + Deactivate Activate diff --git a/modules/base/templates/report.tpl b/modules/base/templates/report.tpl index 8f21f3d6c..dabfaaf35 100644 --- a/modules/base/templates/report.tpl +++ b/modules/base/templates/report.tpl @@ -1,13 +1,17 @@ -
- - makeNavigation($top_level_report_nav);?> - +
+ makeTwoLevelNav($top_level_report_nav, $sub_nav);?>
-

-

- Report Filters - -
+ +
+ +
+ +
+ Report Filters + +
+ + - \ No newline at end of file +
\ No newline at end of file diff --git a/modules/base/templates/report_geolocation.tpl b/modules/base/templates/report_geolocation.tpl new file mode 100644 index 000000000..c86771e01 --- /dev/null +++ b/modules/base/templates/report_geolocation.tpl @@ -0,0 +1,125 @@ +

+ +

View in Google Earth

+ +config['google_maps_api_key'])):?> + + + + + + + + + +
+
+ Visitors + +
+
+
+ +
+ + + + + + You must have a Google Maps API Key to use this feature. Google provides this key for free. + You can get a key in minutes by visiting this Google web site and then + entering the key on the main OWA configuration page. + + \ No newline at end of file diff --git a/modules/base/templates/report_latest_visits.tpl b/modules/base/templates/report_latest_visits.tpl index 596596e2e..37e202f2e 100644 --- a/modules/base/templates/report_latest_visits.tpl +++ b/modules/base/templates/report_latest_visits.tpl @@ -1,93 +1,7 @@ -
-
- - / @ at : | - - , - choose_browser_icon($visit['ua_browser_type']);?> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Visitor - - - - - - - New Visitor - - Returning Visitor (Last visit was - - day ago. - - days ago. - - ) - - -
- -
- Pages -
-
- - -
-
-
- - -
- Entry Page - - () -
- - Refering URL - - truncate($visit['referer_page_title'], 80, '...');?> truncate($visit['referer_url'], 35, '...');?>truncate($visit['referer_url'], 50, '...');?> -
- -
- -
-
+ diff --git a/modules/base/templates/report_period_filters.tpl b/modules/base/templates/report_period_filters.tpl index 476e346bc..e5a323e11 100644 --- a/modules/base/templates/report_period_filters.tpl +++ b/modules/base/templates/report_period_filters.tpl @@ -20,13 +20,13 @@ - +
- - - + - - - + diff --git a/modules/base/templates/report_visit_summary.tpl b/modules/base/templates/report_visit_summary.tpl new file mode 100644 index 000000000..ac875bb69 --- /dev/null +++ b/modules/base/templates/report_visit_summary.tpl @@ -0,0 +1,87 @@ +
+
+ + / @ at : | + - , + choose_browser_icon($visit['ua_browser_type']);?> + + +
+ CHECKED> Time Period:
+
Time Period:
+ CHECKED> Date Period: + Date Period:
:: - ()
+ ()
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Visitor + + + + - + + New Visitor + + Returning Visitor (Last visit was + + day ago. + + days ago. + + ) + + +
+ +
+ Pages +
+
+ + +
+
+
+ + +
+ Entry Page + + () +
+ + Refering URL + + truncate($visit['referer_page_title'], 80, '...');?> truncate($visit['referer_url'], 35, '...');?>truncate($visit['referer_url'], 50, '...');?> +
+ +
+ + +
\ No newline at end of file diff --git a/modules/base/templates/report_visit_summary_balloon.tpl b/modules/base/templates/report_visit_summary_balloon.tpl new file mode 100644 index 000000000..8743b51b4 --- /dev/null +++ b/modules/base/templates/report_visit_summary_balloon.tpl @@ -0,0 +1,58 @@ +

+

+ + + New Visitor + + Returning Visitor (Last visit was + + day ago. + + days ago. + + ) + + choose_browser_icon($visit['ua_browser_type']);?>

+ + - / at : +

+ + +, + +

+ + + + + + + + + + + + + + + +
+ Visitor + + + + +
+ Entry Page + + ()
+ +
+ Refering URL + + truncate($visit['referer_page_title'], 80, '...');?> truncate($visit['referer_url'], 35, '...');?>truncate($visit['referer_url'], 50, '...');?> +
+ +

View Visit Details

+ +
\ No newline at end of file diff --git a/modules/base/templates/report_visitors.tpl b/modules/base/templates/report_visitors.tpl index 6d9cdbae3..595725ecb 100644 --- a/modules/base/templates/report_visitors.tpl +++ b/modules/base/templates/report_visitors.tpl @@ -1,5 +1,7 @@

+

+

Age of Visitors - diff --git a/modules/base/templates/wrapper_default.tpl b/modules/base/templates/wrapper_default.tpl index 8d40b8b8c..e7aed3743 100644 --- a/modules/base/templates/wrapper_default.tpl +++ b/modules/base/templates/wrapper_default.tpl @@ -1,30 +1,19 @@ - - - - - - Open Web Analytics - <?=$page_title;?> - - - - - - - - -
- -
- - - - - -
- - + + + + + + Open Web Analytics - <?=$page_title;?> + + + + + + + + + + + + \ No newline at end of file diff --git a/modules/base/templates/wrapper_email.tpl b/modules/base/templates/wrapper_email.tpl index 491b13eef..4524daab6 100644 --- a/modules/base/templates/wrapper_email.tpl +++ b/modules/base/templates/wrapper_email.tpl @@ -1,8 +1,3 @@ - - - Open Web Analytics E-mail - - - - - \ No newline at end of file +Open Web Analytics \n + + diff --git a/modules/base/templates/wrapper_wordpress.tpl b/modules/base/templates/wrapper_wordpress.tpl index 265edae40..9a5e816a2 100644 --- a/modules/base/templates/wrapper_wordpress.tpl +++ b/modules/base/templates/wrapper_wordpress.tpl @@ -1,8 +1,7 @@ - - -
- - - - -
+ + + + + + + diff --git a/modules/base/templates/xml_visits_geolocation.tpl b/modules/base/templates/xml_visits_geolocation.tpl new file mode 100644 index 000000000..c1d42ed75 --- /dev/null +++ b/modules/base/templates/xml_visits_geolocation.tpl @@ -0,0 +1,13 @@ + + + + + + + ]]> + + + + + + \ No newline at end of file diff --git a/modules/base/xmlVisitsGeolocation.php b/modules/base/xmlVisitsGeolocation.php new file mode 100644 index 000000000..d258f836f --- /dev/null +++ b/modules/base/xmlVisitsGeolocation.php @@ -0,0 +1,138 @@ + + * @copyright Copyright © 2006 Peter Adams + * @license http://www.gnu.org/copyleft/gpl.html GPL v2.0 + * @category owa + * @package owa + * @version $Revision$ + * @since owa 1.0.0 + */ + +class owa_xmlVisitsGeolocationController extends owa_reportController { + + function owa_xmlVisitsGeolocationController($params) { + + $this->owa_reportController($params); + $this->priviledge_level = 'viewer'; + + return; + } + + function action() { + + // Load the core API + $api = &owa_coreAPI::singleton($this->params); + + $data = array(); + $data['params'] = $this->params; + + //$this->params['period'] = 'last_thirty_days'; + + + if ($this->params['site_id']): + //get site labels + $s = owa_coreAPI::entityFactory('base.site'); + $s->getByColumn('site_id', $this->params['site_id']); + $data['site_name'] = $s->get('name'); + $data['site_description'] = $s->get('description'); + else: + $data['site_name'] = 'All Sites'; + $data['site_description'] = 'All Sites Tracked by OWA'; + endif; + + $data['latest_visits'] = $api->getMetric('base.latestVisits', array( + + 'constraints' => array('site_id' => $this->params['site_id']), + 'limit' => 100, + //'period' => 'last_thirty_days', + 'orderby' => array('session.timestamp'), + 'order' => 'DESC' + + )); + + + + $data['view'] = 'base.xmlVisitsGeolocation'; + + + return $data; + + } + +} + + + +/** + * Visits Geolocation xml View + * + * @author Peter Adams + * @copyright Copyright © 2006 Peter Adams + * @license http://www.gnu.org/copyleft/gpl.html GPL v2.0 + * @category owa + * @package owa + * @version $Revision$ + * @since owa 1.0.0 + */ + +class owa_xmlVisitsGeolocationView extends owa_view { + + function owa_xmlVisitsGeolocationView() { + + $this->owa_view(); + $this->priviledge_level = 'guest'; + + return; + } + + function construct($data) { + + $this->t->set_template('wrapper_blank.tpl'); + + // load body template + $this->body->set_template('xml_visits_geolocation.tpl'); + //$this->body->set_template('kml_google_sample.tpl'); + $this->body->set('visits', $data['latest_visits']); + $this->body->set('site_name', $data['site_name']); + $this->body->set('site_domain', $data['site_domain']); + $this->body->set('site_description', $data['site_description']); + + $this->_setLinkState(); + + header('Content-type: text/xml', true); + //header('Content-type: text/plain', true); + return; + } + + +} + + +?> \ No newline at end of file diff --git a/modules/hello/module.php b/modules/hello/module.php new file mode 100644 index 000000000..249d1c289 --- /dev/null +++ b/modules/hello/module.php @@ -0,0 +1,106 @@ + + * @copyright Copyright © 2006 Peter Adams + * @license http://www.gnu.org/copyleft/gpl.html GPL v2.0 + * @category owa + * @package owa + * @version $Revision$ + * @since owa 1.0.0 + */ + +class owa_helloModule extends owa_module { + + + function owa_helloModule() { + + $this->name = 'hello'; + $this->display_name = 'Hello World'; + $this->group = 'hello'; + $this->author = 'Peter Adams'; + $this->version = '1.0'; + $this->description = 'Hello world sample module.'; + $this->config_required = false; + + $this->owa_module(); + + return; + } + + /** + * Registers Admin panels with the core API + * + */ + function registerAdminPanels() { + + $this->addAdminPanel(array( 'do' => 'hello.admin', + 'priviledge' => 'admin', + 'anchortext' => 'Hello World!', + 'group' => 'Test', + 'order' => 1)); + + + return; + + } + + function registerNavigation() { + + /*$this->addNavigationLink(array('view' => 'base.reportDocument', + 'nav_name' => 'subnav', + 'ref' => 'base.reportClicks', + 'priviledge' => 'viewer', + 'anchortext' => 'Click Map Report', + 'order' => 1)); + + */ + + return; + + } + + /** + * Registers Event Handlers with queue queue + * + */ + function _registerEventHandlers() { + + + // Clicks + $this->_addHandler('base.click', 'clickHandlers'); + + return; + + } + + function _registerEntities() { + + $this->entities[] = 'request'; + } + + +} + + +?> \ No newline at end of file diff --git a/owa_auth.php b/owa_auth.php index 24eda762c..7f9c99659 100644 --- a/owa_auth.php +++ b/owa_auth.php @@ -91,7 +91,7 @@ function owa_auth() { $this->params = &owa_requestContainer::getInstance(); //sets credentials based on whatever is passed in on params - $this->_setCredentials($this->params['u'], $this->params['p']); + $this->_setCredentials($this->params['u'], $this->params['p'], $this->params['pk']); return; @@ -146,15 +146,29 @@ function authenticateUser($necessary_role = '') { return $data; endif; + // carve out for url passkey authentication + if(!empty($this->credentials['passkey'])): + $status = $this->authenticateUserByUrlPasskey($this->credentials['user_name'], $this->credentials['passkey']); + + if ($status == true): + $data['auth_status'] = true; + return $data; + else: + $data = $this->_setNotAuthenticatedView(); + $data['auth_status'] = false; + return $data; + endif; + endif; + // if the user has no credentials then redirect them to the login page. - if($this->check_for_credentails == true): + //if($this->check_for_credentails == true): if ((empty($this->credentials['user_id'])) || (empty($this->credentials['password']))): // show login page $data = $this->_setNotAuthenticatedView(); $data['auth_status'] = false; return $data; endif; - endif; + //endif; // lookup user if not already done. if ($this->_is_user == false): @@ -224,6 +238,26 @@ function authenticateUserTempPasskey($key) { } + /** + * Authenticates user by a passkey + * + * @param unknown_type $key + * @return unknown + */ + function authenticateUserByUrlPasskey($user_name, $passkey) { + + $this->getUser(); + + $key =$this->generateUrlPasskey($this->u->get('user_id'), $this->u->get('password')); + + if ($key == $passkey): + return true; + else: + return false; + endif; + + } + /** * abstract method for Checking to see if the user credentials match a real user object in the DB * @@ -281,6 +315,12 @@ function generateTempPasskey($seed) { return md5($seed.time().rand()); } + function generateUrlPasskey($user_name, $password) { + + return md5($user_name . $password); + + } + /** * Sets the initial Passkey for a new user * @@ -294,10 +334,11 @@ function setInitialPasskey($user_id) { } - function _setCredentials($user_id, $password) { + function _setCredentials($user_id = '', $password = '', $passkey = '') { $this->credentials['user_id'] = $user_id; $this->credentials['password'] = $password; + $this->credentials['passkey'] = $passkey; return; } diff --git a/owa_base.php b/owa_base.php index a79e03cca..eb6ed52df 100644 --- a/owa_base.php +++ b/owa_base.php @@ -76,7 +76,7 @@ class owa_base { function owa_base() { $this->c = &owa_coreAPI::configSingleton(); - $this->config = $this->c->fetch('base'); + $this->config = &$this->c->fetch('base'); $this->e = &owa_error::get_instance(); return; diff --git a/owa_browscap.php b/owa_browscap.php index 7039fe3a1..7e37e1305 100644 --- a/owa_browscap.php +++ b/owa_browscap.php @@ -1,4 +1,4 @@ -c->load($config['configuration_id']); endif; + + //Apply URL config vales. + $this->c->applyUrls(); // Applies run time config overrides $this->c->applyModuleOverrides('base', $config); + $this->e->debug('applying caller config overrides.'); + + // re-fetch the array now that overrides have been applied. // needed for backwards compatability @@ -100,6 +106,8 @@ function owa_caller($config) { // Load the core API $this->api = &owa_coreAPI::singleton(); + $this->api->caller_config_overrides = $config; + // should only be called once to load all modules $this->api->setupFramework(); @@ -138,8 +146,9 @@ function log($caller_params = '') { */ function logEvent($event_type, $caller_params = '') { + $params = array(); // Add PHP's $_SERVER scope variables to event properties - $params = $_SERVER; + $params['server'] = $_SERVER; // Apply caller's params to event properties if (!empty($caller_params)): @@ -147,7 +156,7 @@ function logEvent($event_type, $caller_params = '') { // Apply caller specific params foreach ($caller_params as $k => $v) { - $params[$k] = $v; + $params['caller'][$k] = $v; } @@ -160,7 +169,7 @@ function logEvent($event_type, $caller_params = '') { $params = owa_lib::inputFilter($params); //Load browscap - $bcap = new owa_browscap($params['HTTP_USER_AGENT']); ///! + $bcap = new owa_browscap($params['server']['HTTP_USER_AGENT']); ///! // Abort if the request is from a robot if ($this->config['log_robots'] != true): @@ -174,7 +183,7 @@ function logEvent($event_type, $caller_params = '') { foreach ($bcap_array as $k => $v) { - $params['browscap_'.$k] = $v; + $params['browscap'] = $bcap_array; } @@ -195,7 +204,7 @@ function logEventFromUrl($caller_params) { //$clean_params = owa_lib::inputFilter($caller_params); $striped_params = owa_lib::stripParams($caller_params); - + $params =array(); // Apply caller specific params foreach ($striped_params as $k => $v) { @@ -215,6 +224,17 @@ function requestTag($site_id) { } + function placeHelperPageTags($echo = true) { + + if ($echo == true): + echo $this->handleHelperPageTagsRequest(); + return; + else: + return $this->handleHelperPageTagsRequest(); + endif; + + } + function handleHelperPageTagsRequest() { $params = array(); @@ -304,6 +324,12 @@ function performAction($action) { endif; + elseif(!empty($data['do'])): + + if ($data['view_method'] == 'redirect'): + owa_lib::redirectToView($data); + return; + endif; endif; return; @@ -344,7 +370,7 @@ function handleRequest($caller_params = null) { unset($this->params['view']); else: - print 'Caller: No view or action param found. I\'m not sure what to do here.'; + print "Caller: No view or action param found. I'm not sure what to do here."; return; endif; diff --git a/owa_controller.php b/owa_controller.php index 807937b57..b377ea039 100644 --- a/owa_controller.php +++ b/owa_controller.php @@ -55,6 +55,13 @@ class owa_controller extends owa_base { */ var $v; + /** + * Data container + * + * @var Array + */ + var $data = array(); + /** * Constructor * @@ -78,6 +85,16 @@ function doAction() { $this->e->debug('Performing Action: '.get_class($this)); + // set status msg + if (!empty($this->params['status_code'])): + $this->data['status_msg'] = $this->getMsg($this->params['status_code']); + endif; + + // get error msg from error code passed on the query string from a redirect. + if (!empty($this->params['error_code'])): + $this->data['error_msg'] = $this->getMsg($this->params['error_code']); + endif; + if (!empty($this->v)): $this->v->doValidations(); diff --git a/owa_coreAPI.php b/owa_coreAPI.php index 7cfd88471..3d8c147bf 100644 --- a/owa_coreAPI.php +++ b/owa_coreAPI.php @@ -39,8 +39,20 @@ class owa_coreAPI extends owa_base { var $init; + /** + * Container for request params + * + * @var array + */ var $params; + /** + * Container for caller config overrides. + * + * @var array + */ + var $caller_config_overrides; + function owa_coreAPI() { @@ -395,25 +407,29 @@ function getNavigation($view, $nav_name, $sortby ='order') { $module_nav = $v->getNavigationLinks(); - //print_r($module_nav); - - // assemble the navigation for a specific view's named navigation element' - foreach ($module_nav as $key => $value) { - - $links[$value['view']][$value['nav_name']][] = $value; - } + + if (!empty($module_nav)): + // assemble the navigation for a specific view's named navigation element' + foreach ($module_nav as $key => $value) { + + $links[$value['view']][$value['nav_name']][] = $value; + } + endif; } //print_r($links[$view][$nav_name]); - - // anonymous sorting function, takes sort by variable. - $code = "return strnatcmp(\$a['$sortby'], \$b['$sortby']);"; - - // sort the array - $ret = usort($links[$view][$nav_name], create_function('$a,$b', $code)); - - return $links[$view][$nav_name]; + if (!empty($links[$view][$nav_name])): + // anonymous sorting function, takes sort by variable. + $code = "return strnatcmp(\$a['$sortby'], \$b['$sortby']);"; + + // sort the array + $ret = usort($links[$view][$nav_name], create_function('$a,$b', $code)); + + return $links[$view][$nav_name]; + else: + return false; + endif; } diff --git a/owa_db.php b/owa_db.php index 94e3f89e6..d690e5dad 100644 --- a/owa_db.php +++ b/owa_db.php @@ -207,4 +207,4 @@ function _timerEnd() { } } -?> +?> \ No newline at end of file diff --git a/owa_env.php b/owa_env.php index 98ce7f873..dd6b39f7f 100644 --- a/owa_env.php +++ b/owa_env.php @@ -41,5 +41,4 @@ define('OWA_GRAPHS_DIR', OWA_BASE_DIR.'/plugins/graphs/'); define('OWA_CONF_DIR', OWA_BASE_DIR.'/conf/'); define('OWA_VERSION', '1.0'); -define('OWA_PUBLIC_DIR', dirname($_SERVER['PHP_SELF'])); ?> \ No newline at end of file diff --git a/owa_httpRequest.php b/owa_httpRequest.php index 7499868e4..437602645 100644 --- a/owa_httpRequest.php +++ b/owa_httpRequest.php @@ -1,4 +1,4 @@ -config['inter_admin_link_template'], - $this->config['admin_url'], - $admin_page, - $get); - } function makeLinkQueryString($query_params) { @@ -602,13 +581,11 @@ function moduleFactory($modulefile, $class_suffix = null, $params = '') { */ function redirectToView($data) { - //$config = &owa_settings::get_settings(); $c = &owa_coreAPI::configSingleton(); $config = $c->fetch('base'); $control_params = array('view_method', 'auth_status'); - //$url = $config['public_url'].'/main.php?'; $get = ''; diff --git a/owa_metric.php b/owa_metric.php index c87b23948..85ebc35d9 100644 --- a/owa_metric.php +++ b/owa_metric.php @@ -371,4 +371,4 @@ function get_metric($params) { } -?> +?> \ No newline at end of file diff --git a/owa_module.php b/owa_module.php index a0c79c140..20ec428a8 100644 --- a/owa_module.php +++ b/owa_module.php @@ -380,7 +380,4 @@ function _registerEntities() { } - - - ?> \ No newline at end of file diff --git a/owa_news.php b/owa_news.php index 7f2d5ec4a..7e873975b 100644 --- a/owa_news.php +++ b/owa_news.php @@ -1,4 +1,4 @@ -config = $c->fetch('base'); + $this->config = &$c->fetch('base'); $this->e = &owa_error::get_instance(); $this->crawler = new owa_http; $this->cache_dir = ''; @@ -151,7 +151,7 @@ function Parse ($rss_url) { } else // Error in opening return False { - print 'no rss content'; + $this->e->notice('no rss content found at: '.$rss_url); return False; } } diff --git a/owa_observer.php b/owa_observer.php index acc3c0d71..6c30a2323 100644 --- a/owa_observer.php +++ b/owa_observer.php @@ -143,3 +143,5 @@ function sendMail($email_address, $subject, $msg) { } } + +?> \ No newline at end of file diff --git a/owa_php.php b/owa_php.php index e47cf2653..1f47e7bcc 100644 --- a/owa_php.php +++ b/owa_php.php @@ -1,54 +1,52 @@ -log($app_params); - * - * @author Peter Adams - * @copyright Copyright © 2006 Peter Adams - * @license http://www.gnu.org/copyleft/gpl.html GPL v2.0 - * @category owa - * @package owa - * @version $Revision$ - * @since owa 1.0.0 - */ - -class owa_php extends owa_caller { - - function owa_php($config = null) { - - $this->owa_caller($config); - - return; - - } - - - -} - +log($app_params); + * + * @author Peter Adams + * @copyright Copyright © 2006 Peter Adams + * @license http://www.gnu.org/copyleft/gpl.html GPL v2.0 + * @category owa + * @package owa + * @version $Revision$ + * @since owa 1.0.0 + */ + +class owa_php extends owa_caller { + + function owa_php($config = null) { + + $this->owa_caller($config); + + return; + + } + +} + ?> \ No newline at end of file diff --git a/owa_template.php b/owa_template.php index 2c6a97ac2..8be4df287 100644 --- a/owa_template.php +++ b/owa_template.php @@ -1,4 +1,4 @@ -caller_params = $caller_params; @@ -144,7 +144,8 @@ function choose_browser_icon($browser_type) { } if (!empty($file)): - return $icon = "config['images_url']."/".$file."\">"; + + return sprintf('makeImageLink($file)); else: return $browser_type; endif; @@ -187,22 +188,78 @@ function makeLinkQueryString($query_params) { } + /** + * Makes navigation links by checking whether or not the view + * that is rendering the template is not the view being refered to in the link. + * + * @param array navigation array + */ function makeNavigation($nav) { - $navigation = '