Skip to content

Commit

Permalink
fixed install bugs.
Browse files Browse the repository at this point in the history
changing name of tracking controller class.
  • Loading branch information
padams committed Sep 23, 2006
1 parent 16f1a63 commit fca567a
Show file tree
Hide file tree
Showing 18 changed files with 272 additions and 209 deletions.
71 changes: 33 additions & 38 deletions owa_caller.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

include_once('owa_env.php');
require_once 'owa_settings_class.php';
require_once 'owa_controller.php';
require_once 'owa_logger_controller.php';
require_once 'owa_installer.php';
require_once 'owa_site.php';

Expand Down Expand Up @@ -129,7 +129,7 @@ function load_config_from_db() {
*
* @param array $app_params This is an array of application specific request params
*/
function log($app_params) {
function log($app_params = '') {

return $this->controller->logEvent('page_request', $app_params);

Expand All @@ -142,43 +142,12 @@ function log($app_params) {
* @param string $event_type
* @return boolean
*/
function logEvent($event_type, $app_params) {
function logEvent($event_type, $app_params = '') {

return $this->controller->logEvent($event_type, $app_params);

}

/**
* Installation Controller
*
* @param string $type
* @param array $params
* @return boolean
*/
function install($type, $params = '') {

$this->config['fetch_config_from_db'] = false;
$installer = &owa_installer::get_instance();
$install_check = $installer->plugins[$type]->check_for_schema();

if ($install_check == false):
//Install owa schema
$status = $installer->plugins[$type]->install();
//Save Default Site
$site = new owa_site;
$site->name = $params['name'];
$site->description = $params['description'];
$site->save();

else:
// owa already installed
$status = false;
endif;

return $status;

}

function reset_config() {

$config = $this->config->get_default_config();
Expand Down Expand Up @@ -293,6 +262,9 @@ function save_config($form_data) {

/**
* Returns All Page Tags
*
* Setting $echo to false allows you to pass the tag code to whatever code is going
* to render your web page
*
* @param boolean $echo
* @return string
Expand Down Expand Up @@ -340,19 +312,38 @@ function firstHitTag($echo = true) {

}

function placeAllBugs($echo = true) {

$bug = $this->place_log_bug(false);
$bug .= $this->place_click_bug(false);

if ($echo === false):
return $bug;
else:
echo $bug;
endif;

return;

}

/**
* Echos the request logger javascript library
*
*/
function place_log_bug() {
function place_log_bug($echo = true) {

$url = $this->config['public_url'].'/page.php?';

$bug = 'var owa_url = \'' . $url . '\';';

$bug .= file_get_contents(OWA_INCLUDE_DIR.'/webbug.js');

echo $bug;
if ($echo === false):
return $bug;
else:
echo $bug;
endif;

return;

Expand All @@ -374,15 +365,19 @@ function clickTag($echo = true) {

}

function place_click_bug() {
function place_click_bug($echo = true) {

$url = $this->config['action_url'].'?owa_action=log_event&event=click&';

$js = file_get_contents(OWA_INCLUDE_DIR.'/clickbug.js');

$bug = sprintf($js, $url, $url);

echo $bug;
if ($echo === false):
return $bug;
else:
echo $bug;
endif;

return;

Expand Down
19 changes: 2 additions & 17 deletions owa_controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,11 @@
//

require_once 'owa_event_class.php';
require_once 'owa_settings_class.php';
require_once 'owa_request_class.php';
require_once 'owa_click.php';
require_once 'owa_lib.php';
require_once 'owa_error.php';
require_once 'owa_browscap.php';
require_once 'owa_base.php';

/**
* owa Controler
Expand All @@ -36,22 +35,8 @@
* @since owa 1.0.0
*/

class owa {
class owa extends owa_base {

/**
* Configuration
*
* @var array
*/
var $config = array();

/**
* Error Handler
*
* @var object
*/
var $e;

/**
* Constructor
*
Expand Down
22 changes: 22 additions & 0 deletions owa_install.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,13 @@ class owa_install {
*/
var $e;

/**
* Params array
*
* @var array
*/
var $params;

/**
* Constructor
*
Expand All @@ -75,6 +82,21 @@ function owa_install() {
return;
}

function addDefaultSite() {

$site = new owa_site;
$site->name = $this->params['name'];
$site->description = $this->params['description'];
if (!empty($site->site_family)):
$site->site_family = $this->params['description'];
else:
$site->site_family = 1;
endif;
$site_id = $site->save();

return;
}

}

?>
15 changes: 9 additions & 6 deletions owa_installer.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,31 +74,34 @@ class owa_installer {
*/
var $plugins;

var $params;

/**
* Constructor
*
* @return owa_install
*/
function owa_installer() {

function owa_installer($params = '') {
$this->params = $params;
$this->config = &owa_settings::get_settings();
$this->db = &owa_db::get_instance();
$this->e = &owa_error::get_instance();
$this->plugins_dir = $this->config['install_plugin_dir'].$this->config['db_type'];
$this->load_plugins();


return;
}

/**
* Installation factory
*
* @param string $type
* @param array $params
* @return object
*/
function &get_instance() {
function &get_instance($params) {

$class = new owa_installer;
$class = new owa_installer($params);
return $class;

}
Expand All @@ -119,7 +122,7 @@ function load_plugins() {
//$this->plugins[] = substr($file, 0, -4);
$class = substr($file, 0, -4);

$plugin = new $class;
$plugin = new $class($this->params);

if (!isset($this->plugins[$package])):
$this->plugins[$plugin->package] = $plugin;
Expand Down
3 changes: 2 additions & 1 deletion owa_settings_class.php
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,8 @@ function get_default_config() {
'summary_framework' => '',
'click_drawing_mode' => 'center_on_page',
'log_clicks' => true,
'authentication' => 'simple'
'authentication' => 'simple',
'owa_wiki_link_template' => 'http://wiki.openwebanalytics.com/index.php?title=%s'
);
}

Expand Down
31 changes: 25 additions & 6 deletions owa_site.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,13 @@ function owa_site() {
return;
}


function getSiteByPK($site_id) {

return $this->getSite($site_id);

}

/**
* Retrieves the site from the database
*
Expand All @@ -111,7 +118,7 @@ function owa_site() {
function getSite($site_id) {

$row = $this->db->get_row(sprintf("SELECT
id,
site_id,
name,
description,
site_family
Expand All @@ -122,17 +129,29 @@ function getSite($site_id) {
$this->config['ns'].$this->config['sites_table'],
$site_id));
if (!empty($row)):
$this->id = $row['id'];
$this->site_id = $site_id;
$this->site_name = $row['name'];
$this->description = $row['description'];
$this->site_family = $row['site_family'];
$this->_setAttributes($row);
return true;
else:
return false;
endif;
}

/**
* Sets user object attributes
*
* @param unknown_type $array
*/
function _setAttributes($array) {

foreach ($array as $n => $v) {

$this->$n = $v;

}

return;
}


function save() {

Expand Down
4 changes: 4 additions & 0 deletions owa_template.php
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,10 @@ function getAuthStatus() {
return $auth->auth_status;
}

function makeWikiLink($page) {

return sprintf($this->config['owa_wiki_link_template'], $page);
}
}

?>
26 changes: 26 additions & 0 deletions owa_wp.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,32 @@ function logComment() {

}

/**
* Installation Controller
*
* @param string $type
* @param array $params
* @return boolean
*/
function install($type, $params = '') {

$this->config['fetch_config_from_db'] = false;
$installer = &owa_installer::get_instance($params);
$install_check = $installer->plugins[$type]->check_for_schema();

if ($install_check == false):
//Install owa schema
$status = $installer->plugins[$type]->install();
$default_site = $installer->plugins[$type]->addDefaultSite();
else:
// owa already installed
$status = false;
endif;

return $status;

}



}
Expand Down
Loading

0 comments on commit fca567a

Please sign in to comment.