function __construct($params) { if (array_key_exists('goal_number', $params)) { $goal_number = $params['goal_number']; } $siteId = owa_coreAPI::getRequestParam('siteId'); if ($siteId) { $gm = owa_coreAPI::getGoalManager($siteId); $goal = $gm->getGoal($goal_number); $this->setLabel("G{$goal_number} Value"); } else { $this->setLabel("G{$goal_number} Value"); } $name = 'goal' . $goal_number . 'Value'; $this->setName($name); $this->setEntity('base.session'); $column = 'goal_' . $goal_number . '_value'; $this->setColumn($column); $this->setSelect(sprintf("SUM(%s)", $this->getColumn())); $this->setDataType('currency'); return parent::__construct(); }
function __construct($params) { if (array_key_exists('goal_number', $params)) { $goal_number = $params['goal_number']; } $name = 'goal' . $goal_number . 'Completions'; $this->setName($name); $siteId = owa_coreAPI::getRequestParam('siteId'); if ($siteId) { $gm = owa_coreAPI::getGoalManager($siteId); $goal = $gm->getGoal($goal_number); $this->setLabel(sprintf('G%d: %s', $goal_number, $goal['goal_name'])); } else { $this->setLabel(sprintf('Goal %d Completions', $goal_number)); } $this->setEntity('base.session'); $column = 'goal_' . $goal_number; $this->setColumn($column); $this->setSelect(sprintf("SUM(%s)", $this->getColumn())); $this->setDataType('integer'); return parent::__construct(); }
/** * Install Page Wrapper Script * * @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 */ // Initialize owa //define('OWA_ERROR_HANDLER', 'development'); define('OWA_CACHE_OBJECTS', false); define('OWA_INSTALLING', true); $owa = new owa_php(); if ($owa->isEndpointEnabled(basename(__FILE__))) { // need third param here so that seting is not persisted. $owa->setSetting('base', 'main_url', 'install.php'); // run controller, echo page content $do = owa_coreAPI::getRequestParam('do'); $params = array(); if (empty($do)) { $params['do'] = 'base.installStart'; } // run controller or view and echo page content echo $owa->handleRequest($params); } else { // unload owa $owa->restInPeace(); }
/** * Handles OWA internal page/action requests * * @return unknown */ public static function handleRequest($caller_params = null, $action = '') { static $init; $service = owa_coreAPI::serviceSingleton(); // Override request parsms with those passed by caller if (!empty($caller_params)) { $service->request->mergeParams($caller_params); } $params = $service->request->getAllOwaParams(); if ($init != true) { owa_coreAPI::debug('Handling request with params: ' . print_r($params, true)); } // backwards compatability with old style view/controler scheme // still needed?? if (array_key_exists('view', $params)) { // its a view request so the only data is in whats in the params $init = true; return owa_coreAPI::displayView($params); } if (empty($action)) { $action = owa_coreAPI::getRequestParam('action'); if (empty($action)) { $action = owa_coreAPI::getRequestParam('do'); if (empty($action)) { $action = owa_coreAPI::getSetting('base', 'start_page'); $params['do'] = $action; } } } $init = true; owa_coreAPI::debug('About to perform action: ' . $action); return owa_coreAPI::performAction($action, $params); }
function getDomstream($domstream_guid) { if (!$domstream_guid) { return; } // Fetch document object $d = owa_coreAPI::entityFactory('base.domstream'); //$d->load($this->getParam('domstream_id')); //$json = new Services_JSON(); //$d->set('events', $json->decode($d->get('events'))); $db = owa_coreAPI::dbSingleton(); $db->select('*'); $db->from($d->getTableName()); $db->where('domstream_guid', $domstream_guid); $db->orderBy('timestamp', 'ASC'); $ret = $db->getAllRows(); //print_r($ret); $combined = ''; foreach ($ret as $row) { $combined = $this->mergeStreamEvents($row['events'], $combined); } $row['events'] = json_decode($combined); $t = new owa_template(); $t->set_template('json.php'); //$json = new Services_JSON(); // set // if not found look on the request scope. $callback = owa_coreAPI::getRequestParam('jsonpCallback'); if (!$callback) { $t->set('json', json_encode($row)); } else { $body = sprintf("%s(%s);", $callback, json_encode($row)); $t->set('json', $body); } return $t->fetch(); }
function render() { // load template $this->t->set_template('wrapper_blank.tpl'); $this->body->set_template('json.php'); $json = new Services_JSON(); // set // look for jsonp callback $callback = $this->get('jsonpCallback'); // if not found look on the request scope. if (!$callback) { $callback = owa_coreAPI::getRequestParam('jsonpCallback'); } if ($callback) { $body = sprintf("%s(%s);", $callback, $json->encode($this->get('json'))); } else { $body = $json->encode($this->get('json')); } $this->body->set('json', $body); }
/** * Returns a configured javascript tracker for inclusion in your web page. * You can pass an options array to control what the tracker will log. * The options array is a key/value pair format like: * * $options = array('do_not_log_pageview' => true); * * Option keys include: 'do_not_log_pageview', 'do_not_log_clicks', 'do_not_log_domstream' * * @param $echo bool if true the function will echo. if false the tracker is returned asa string. * @param $options array an key value pair option array * @return $tag string the tracker javascript. */ function placeHelperPageTags($echo = true, $options = array()) { if (!owa_coreAPI::getRequestParam('is_robot')) { // check to see if first hit tag is needed if (isset($options['delay_first_hit']) || owa_coreAPI::getSetting('base', 'delay_first_hit')) { $service =& owa_coreAPI::serviceSingleton(); //check for persistant cookie $v = $service->request->getOwaCookie('v'); if (empty($v)) { $options['first_hit_tag'] = true; } } if (!class_exists('owa_template')) { require_once OWA_BASE_CLASSES_DIR . 'owa_template.php'; } $t = new owa_template(); $t->set_template('js_helper_tags.tpl'); $tracking_code = owa_coreAPI::getJsTrackerTag($this->getSiteId(), $options); $t->set('tracking_code', $tracking_code); $tag = $t->fetch(); if ($echo == false) { return $tag; } else { echo $tag; } } }
function getCampaignProperties($event) { $campaign_params = owa_coreAPI::getSetting('base', 'campaign_params'); $campaign_properties = array(); $campaign_state = array(); foreach ($campaign_params as $k => $param) { //look for property on the event $property = $event->get($param); // look for property on the request scope. if (!$property) { $property = owa_coreAPI::getRequestParam($param); } if ($property) { $campaign_properties[$k] = $property; } } // backfill values for incomplete param combos if (array_key_exists('at', $campaign_properties) && !array_key_exists('ad', $campaign_properties)) { $campaign_properties['ad'] = '(not set)'; } if (array_key_exists('ad', $campaign_properties) && !array_key_exists('at', $campaign_properties)) { $campaign_properties['at'] = '(not set)'; } if (!empty($campaign_properties)) { //$campaign_properties['ts'] = $event->get('timestamp'); } owa_coreAPI::debug('campaign properties: ' . print_r($campaign_properties, true)); return $campaign_properties; }
ignore_user_abort(true); set_time_limit(180); include_once 'owa_env.php'; require_once OWA_BASE_DIR . '/owa_php.php'; /** * Remote Event Queue Endpoint * * @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.3.0 */ $owa = new owa_php(); if ($owa->isEndpointEnabled(basename(__FILE__))) { $owa->setSetting('base', 'is_remote_event_queue', true); $owa->e->debug('post: ' . print_r($_POST, true)); $raw_event = owa_coreAPI::getRequestParam('event'); if ($raw_event) { $dispatch = owa_coreAPI::getEventDispatch(); $event = $dispatch->makeEvent(); $event->loadFromArray($raw_event); $owa->e->debug(print_r($event, true)); $dispatch->asyncNotify($event); } } else { // unload owa $owa->restInPeace(); }
function execute() { global $wgRequest, $wgOut, $wgUser, $wgSitename, $wgScriptPath, $wgScript, $wgServer, $wgDBtype, $wgDBname, $wgDBserver, $wgDBuser, $wgDBpassword; //must be called after setHeaders for some reason or elsethe wgUser object is not yet populated. $this->setHeaders(); if ($this->userCanExecute($wgUser)) { $owa = owa_singleton(); $params = array(); // if no action is found... $do = owa_coreAPI::getRequestParam('do'); if (empty($do)) { // check to see that owa in installed. if (!$owa->getSetting('base', 'install_complete')) { define('OWA_INSTALLING', true); $site_url = $wgServer . $wgScriptPath; $params = array('site_id' => md5($site_url), 'name' => $wgSitename, 'domain' => $site_url, 'description' => '', 'do' => 'base.installStartEmbedded'); $params['db_type'] = $wgDBtype; $params['db_name'] = $wgDBname; $params['db_host'] = $wgDBserver; $params['db_user'] = $wgDBuser; $params['db_password'] = $wgDBpassword; $params['public_url'] = $wgServer . $wgScriptPath . '/extensions/owa/'; $page = $owa->handleRequest($params); // send to daashboard } else { //$params['do'] = 'base.reportDashboard'; $page = $owa->handleRequest($params); } // do action found on url } else { $page = $owa->handleRequestFromURL(); } return $wgOut->addHTML($page); } else { $this->displayRestrictionError(); } }
/** * Used by controllers to check if the user exists and if they are priviledged. * * @param string $necessary_role */ function authenticateUser() { // check existing auth status first in case someone else took care of this already. if (owa_coreAPI::getCurrentUser()->isAuthenticated()) { $ret = true; } elseif (owa_coreAPI::getRequestParam('apiKey')) { // auth user by api key $ret = $this->authByApiKey(owa_coreAPI::getRequestParam('apiKey')); } elseif (owa_coreAPI::getRequestParam('pk') && owa_coreAPI::getStateParam('u')) { // auth user by temporary passkey. used in forgot password situations $ret = $this->authenticateUserByUrlPasskey(owa_coreAPI::getRequestParam('pk')); } elseif (owa_coreAPI::getRequestParam('user_id') && owa_coreAPI::getRequestParam('password')) { // auth user by login form input $ret = $this->authByInput(owa_coreAPI::getRequestParam('user_id'), owa_coreAPI::getRequestParam('password')); } elseif (owa_coreAPI::getStateParam('u') && owa_coreAPI::getStateParam('p')) { // auth user by cookies $ret = $this->authByCookies(owa_coreAPI::getStateParam('u'), owa_coreAPI::getStateParam('p')); // bump expiration time //owa_coreAPI::setState('p', '', owa_coreAPI::getStateParam('p')); } else { $ret = false; owa_coreAPI::debug("Could not find any credentials to authenticate with."); } // filter results for modules can add their own auth logic. $ret = $this->eq->filter('auth_status', $ret); return array('auth_status' => $ret); }
/** * Logs tracking event * * This function fires a tracking event that will be processed and then dispatched * * @param object $event * @return boolean */ public function trackEvent($event) { // do not track anything if user is in overlay mode if (owa_coreAPI::getStateParam('overlay')) { return false; } $this->setGlobalEventProperty('HTTP_REFERER', owa_coreAPI::getServerParam('HTTP_REFERER')); // needed by helper page tags function so it can append to first hit tag url if (!$this->getSiteId()) { $this->setSiteId($event->get('site_id')); } if (!$this->getSiteId()) { $this->setSiteId(owa_coreAPI::getRequestParam('site_id')); } // set various state properties. $this->manageState($event); $event = $this->setAllGlobalEventProperties($event); // send event to log API for processing. return owa_coreAPI::logEvent($event->getEventType(), $event); }
function owa_pageController() { $owa = owa_getInstance(); $do = owa_coreAPI::getRequestParam('do'); $params = array(); if (empty($do)) { $params['do'] = 'base.reportDashboard'; } echo $owa->handleRequest($params); }
function resultSetToJsonp($callback = '') { // if not found look on the request scope. if (!$callback) { $callback = owa_coreAPI::getRequestParam('jsonpCallback'); } if (!$callback) { return $this->resultSetToJson(); } $t = new owa_template(); $t->set_template('json.php'); // set $body = sprintf("%s(%s);", $callback, json_encode($this)); $t->set('json', $body); return $t->fetch(); }