Beispiel #1
0
 public static function factory($parserClass, $args)
 {
     Kurogo::log(LOG_DEBUG, "Initializing DataParser {$parserClass}", "data");
     if (isset($args['PACKAGE'])) {
         Kurogo::includePackage($args['PACKAGE']);
     }
     if (!class_exists($parserClass)) {
         throw new KurogoConfigurationException("Parser class {$parserClass} not defined");
     }
     $parser = new $parserClass();
     if (!$parser instanceof DataParser) {
         throw new KurogoConfigurationException("{$parserClass} is not a subclass of DataParser");
     }
     $parser->init($args);
     return $parser;
 }
Beispiel #2
0
<?php

/**
 * @package Core
 */
Kurogo::includePackage('db');
class KurogoStats
{
    private $conn;
    private static function connection()
    {
        static $conn;
        if (!$conn) {
            $conn = SiteDB::connection();
        }
        return $conn;
    }
    static $pagetypes = array('tablet' => 'Tablet', 'compliant' => 'Compliant', 'touch' => 'Touch', 'basic' => 'Basic');
    static $platforms = array('iphone' => 'iPhone', 'android' => 'Android', 'webos' => 'webOS', 'winmo' => 'Windows Mobile', 'blackberry' => 'BlackBerry', 'bbplus' => 'Advanced BlackBerry', 'symbian' => 'Symbian', 'palmos' => 'Palm OS', 'featurephone' => 'Other Phone', 'computer' => 'Computer');
    private static function setVisitCookie($visitID = null)
    {
        if (empty($visitID)) {
            $visitID = md5(uniqid(rand(), true));
        }
        setCookie('visitID', $visitID, time() + Kurogo::getOptionalSiteVar('KUROGO_VISIT_LIFESPAN', 1800), COOKIE_PATH);
        return $visitID;
    }
    private static function isFromThisSite($url)
    {
        if (empty($url)) {
            return false;
 private function setPageVariables()
 {
     $this->loadTemplateEngineIfNeeded();
     $this->loadPageConfig();
     // Set variables common to all modules
     $this->assign('moduleID', $this->id);
     $this->assign('configModule', $this->configModule);
     $this->assign('templateModule', $this->templateModule);
     $this->assign('moduleName', $this->moduleName);
     $this->assign('page', $this->page);
     $this->assign('isModuleHome', $this->page == 'index');
     $this->assign('request_uri', $_SERVER['REQUEST_URI']);
     $this->assign('hideFooterLinks', $this->hideFooterLinks);
     $this->assign('ajaxContentLoad', $this->ajaxContentLoad);
     $this->assign('charset', Kurogo::getCharset());
     $this->assign('webBridgeAjaxContentLoad', KurogoWebBridge::isAjaxContentLoad());
     // Font size for template
     $this->assign('fontsizes', $this->fontsizes);
     $this->assign('fontsize', $this->fontsize);
     $this->assign('fontsizeCSS', $this->getFontSizeCSS());
     $this->assign('fontSizeURLs', $this->getFontSizeURLs());
     // Minify URLs
     $this->assign('minify', $this->getMinifyUrls());
     // Google Analytics. This probably needs to be moved
     if ($gaID = Kurogo::getOptionalSiteVar('GOOGLE_ANALYTICS_ID')) {
         $this->assign('GOOGLE_ANALYTICS_ID', $gaID);
         $this->assign('GOOGLE_ANALYTICS_DOMAIN', Kurogo::getOptionalSiteVar('GOOGLE_ANALYTICS_DOMAIN'));
         $this->assign('gaImageURL', $this->googleAnalyticsGetImageUrl($gaID));
     }
     // Breadcrumbs
     $this->loadBreadcrumbs();
     // Tablet module nav list
     if ($this->pagetype == 'tablet' && $this->page != 'pane') {
         $this->addInternalJavascript('/common/javascript/lib/iscroll-4.1.9.js');
         $this->assign('moduleNavList', $this->getModuleNavlist());
     }
     if ($this->page == '__nativeWebTemplates') {
         $title = 'Error!';
         $message = '';
         try {
             if (!Kurogo::isLocalhost()) {
                 throw new KurogoException("{$this->page} command can only be run from localhost");
             }
             $platforms = array_filter(array_map('trim', explode(',', $this->getArg('platform', ''))));
             if (!$platforms) {
                 throw new KurogoException("No platforms specified");
             }
             foreach ($platforms as $platform) {
                 $this->buildNativeWebTemplatesForPlatform($platform);
             }
             $title = 'Success!';
             $message = 'Generated native web templates for ' . implode(' and ', $platforms);
         } catch (Exception $e) {
             $message = $e->getMessage();
         }
         $this->assign('contentTitle', $title);
         $this->assign('contentBody', $message);
     } else {
         if (KurogoWebBridge::useNativeTemplatePageInitializer()) {
             Kurogo::log(LOG_DEBUG, "Calling initializeForNativeTemplatePage for {$this->configModule} - {$this->page}", 'module');
             $this->initializeForNativeTemplatePage();
             //subclass behavior
             Kurogo::log(LOG_DEBUG, "Returned from initializeForNativeTemplatePage for {$this->configModule} - {$this->page}", 'module');
         } else {
             Kurogo::log(LOG_DEBUG, "Calling initializeForPage for {$this->configModule} - {$this->page}", 'module');
             $this->initializeForPage();
             //subclass behavior
             Kurogo::log(LOG_DEBUG, "Returned from initializeForPage for {$this->configModule} - {$this->page}", 'module');
         }
     }
     // Set variables for each page
     $this->assign('pageTitle', $this->pageTitle);
     // Variables which may have been modified by the module subclass
     $this->assign('inlineCSSBlocks', $this->inlineCSSBlocks);
     $this->assign('cssURLs', $this->cssURLs);
     $this->assign('inlineJavascriptBlocks', $this->inlineJavascriptBlocks);
     $this->assign('onOrientationChangeBlocks', $this->onOrientationChangeBlocks);
     $this->assign('onLoadBlocks', $this->onLoadBlocks);
     $this->assign('inlineJavascriptFooterBlocks', $this->inlineJavascriptFooterBlocks);
     $this->assign('javascriptURLs', $this->javascriptURLs);
     $this->assign('breadcrumbs', $this->breadcrumbs);
     $this->assign('breadcrumbArgs', $this->getBreadcrumbArgs());
     $this->assign('breadcrumbSamePageArgs', $this->getBreadcrumbArgs(false));
     $this->assign('moduleDebugStrings', $this->moduleDebugStrings);
     $this->assign('webBridgeOnPageLoadParams', KurogoWebBridge::getOnPageLoadParams($this->pageTitle, $this->breadcrumbTitle, $this->hasWebBridgePageRefresh));
     $this->assign('webBridgeConfig', KurogoWebBridge::getServerConfig($this->configModule, $this->page, $this->args));
     $moduleStrings = $this->getOptionalModuleSection('strings');
     $this->assign('moduleStrings', $moduleStrings);
     $this->assign('homeLink', $this->buildURLForModule($this->getHomeModuleID(), '', array()));
     $this->assign('homeModuleID', $this->getHomeModuleID());
     $this->assignLocalizedStrings();
     if ($this->page == 'help') {
         // Module Help
         $this->assign('hasHelp', false);
         $template = 'common/templates/' . $this->page;
     } else {
         if ($this->page == '__nativeWebTemplates') {
             $template = 'common/templates/staticContent';
         } else {
             if (KurogoWebBridge::useWrapperPageTemplate()) {
                 // Web bridge page wrapper
                 $template = 'common/templates/webBridge';
                 $this->assign('webBridgeJSLocalizedStrings', json_encode(Kurogo::getLocalizedStrings()));
             } else {
                 $this->assign('hasHelp', isset($moduleStrings['help']));
                 $this->assign('helpLink', $this->buildBreadcrumbURL('help', array()));
                 $this->assign('helpLinkText', $this->getLocalizedString('HELP_TEXT', $this->getModuleName()));
                 $template = 'modules/' . $this->templateModule . '/templates/' . $this->templatePage;
             }
         }
     }
     Kurogo::log(LOG_DEBUG, "Template file is {$template}", 'module');
     // Pager support
     if (isset($this->htmlPager)) {
         $this->assign('pager', $this->getPager());
     }
     // Tab support
     if (isset($this->tabbedView)) {
         $this->assign('tabbedView', $this->tabbedView);
     }
     $this->assign('imageExt', $this->imageExt);
     $this->assign($this->getThemeVars());
     // Access Key Start
     $accessKeyStart = count($this->breadcrumbs);
     if ($this->configModule != $this->getHomeModuleID()) {
         $accessKeyStart++;
         // Home link
     }
     $this->assign('accessKeyStart', $accessKeyStart);
     if (Kurogo::getSiteVar('AUTHENTICATION_ENABLED')) {
         Kurogo::includePackage('Authentication');
         $this->setCacheMaxAge(0);
         $session = $this->getSession();
         $this->assign('session', $session);
         $this->assign('session_isLoggedIn', $this->isLoggedIn());
         $this->assign('showLogin', Kurogo::getSiteVar('AUTHENTICATION_ENABLED') && $this->showLogin());
         if ($this->isLoggedIn()) {
             $user = $session->getUser();
             $authority = $user->getAuthenticationAuthority();
             $this->assign('session_userID', $user->getUserID());
             $this->assign('session_fullName', $user->getFullname());
             if (count($session->getUsers()) == 1) {
                 $this->assign('session_logout_url', $this->buildURLForModule($this->getLoginModuleID(), 'logout', array('authority' => $user->getAuthenticationAuthorityIndex())));
                 $this->assign('footerLoginLink', $this->buildURLForModule($this->getLoginModuleID(), '', array()));
                 $this->assign('footerLoginText', $this->getLocalizedString('SIGNED_IN_SINGLE', $authority->getAuthorityTitle(), $user->getFullName()));
                 $this->assign('footerLoginClass', $authority->getAuthorityClass());
             } else {
                 $this->assign('footerLoginClass', 'login_multiple');
                 $this->assign('session_logout_url', $this->buildURLForModule($this->getLoginModuleID(), 'logout', array()));
                 $this->assign('footerLoginLink', $this->buildURLForModule($this->getLoginModuleID(), 'logout', array()));
                 $this->assign('footerLoginText', $this->getLocalizedString('SIGNED_IN_MULTIPLE'));
             }
             if ($session_max_idle = intval(Kurogo::getOptionalSiteVar('AUTHENTICATION_IDLE_TIMEOUT', 0))) {
                 $this->setRefresh($session_max_idle + 2);
             }
         } else {
             $this->assign('footerLoginClass', 'noauth');
             $this->assign('footerLoginLink', $this->buildURLForModule($this->getLoginModuleID(), '', array()));
             $this->assign('footerLoginText', $this->getLocalizedString('SIGN_IN_SITE', Kurogo::getSiteString('SITE_NAME')));
         }
     }
     /* set cache age. Modules that present content that rarely changes can set this value
        to something higher */
     header(sprintf("Cache-Control: max-age=%d", $this->cacheMaxAge));
     header("Expires: " . gmdate('D, d M Y H:i:s', time() + $this->cacheMaxAge) . ' GMT');
     return $template;
 }
Beispiel #4
0
<?php

// classes in here are required for unserialization
Kurogo::includePackage('Maps', 'KML');
Kurogo::includePackage('Maps', 'Shapefile');
class MapSearch extends DataRetriever
{
    protected $searchResults;
    protected $resultCount;
    protected $feeds;
    protected $feedGroup;
    protected $searchParams;
    protected $searchMode;
    const SEARCH_MODE_TEXT = 0;
    const SEARCH_MODE_NEARBY = 1;
    public function __construct($feeds)
    {
        $this->setFeedData($feeds);
    }
    public function setFeedData($feeds)
    {
        $this->feeds = $feeds;
    }
    public function init($args)
    {
        parent::init($args);
        $this->setCacheGroup(get_class($this));
    }
    public function setFeedGroup($feedGroup)
    {
        $this->feedGroup = $feedGroup;
 /**
  * 
  * Initializes an authentication authority object
  * @param string $authorityClass the name of the class to instantiate. Must be a subclass of AuthenticationAuthority
  * @param array $args an associative array of arguments. Argument values depend on the authority
  * @return AuthenticationAuthority
  * @see AuthenticationAuthority::init()
  */
 public static function factory($authorityClass, $args)
 {
     if (isset($args['PACKAGE'])) {
         Kurogo::includePackage($args['PACKAGE']);
     }
     if (!class_exists($authorityClass) || !is_subclass_of($authorityClass, 'AuthenticationAuthority')) {
         throw new KurogoConfigurationException("Invalid authentication class {$authorityClass}");
     }
     $authority = new $authorityClass();
     $authority->init($args);
     return $authority;
 }
Beispiel #6
0
<?php

/*
 * Copyright © 2010 - 2012 Modo Labs Inc. All rights reserved.
 *
 * The license governing the contents of this file is located in the LICENSE
 * file located at the root directory of this distribution. If the LICENSE file
 * is missing, please contact sales@modolabs.com.
 *
 */
Kurogo::includePackage('News');
class AthleticsAPIModule extends APIModule
{
    protected $id = 'athletics';
    protected $vmin = 1;
    protected $vmax = 1;
    protected $imageExt = ".png";
    protected static $defaultEventModel = 'AthleticEventsDataModel';
    protected static $defaultNewsModel = 'NewsDataModel';
    protected $maxPerPage = 10;
    protected $feeds;
    protected $navFeeds;
    protected function cleanContent($content)
    {
        //deal with pre tags. strip out pre tags and add <br> for newlines
        $bits = preg_split('#(<pre.*?' . '>)(.*?)(</pre>)#s', $content, -1, PREG_SPLIT_DELIM_CAPTURE);
        $content = array_shift($bits);
        $i = 0;
        while ($i < count($bits)) {
            $tag = $bits[$i++];
            $content .= nl2br($bits[$i++]);
<?php

Kurogo::includePackage('People');
class PeopleAPIModule extends APIModule
{
    protected $id = 'people';
    protected $vmin = 1;
    protected $vmax = 1;
    private $fieldConfig;
    protected $contactGroups = array();
    protected function getContactGroup($group)
    {
        if (!$this->contactGroups) {
            $this->contactGroups = $this->getModuleSections('api-contacts-groups');
        }
        if (isset($this->contactGroups[$group])) {
            if (!isset($this->contactGroups[$group]['contacts'])) {
                $this->contactGroups[$group]['contacts'] = $this->getModuleSections('api-contacts-' . $group);
            }
            if (!isset($this->contactGroups[$group]['description'])) {
                $this->contactGroups[$group]['description'] = '';
            }
            return $this->contactGroups[$group];
        } else {
            throw new KurogoConfigurationException("Unable to find contact group information for {$group}");
        }
    }
    private function formatPerson($person)
    {
        $result = array();
        foreach ($this->fieldConfig as $fieldID => $fieldOptions) {
<?php

/*
 * Copyright © 2010 - 2012 Modo Labs Inc. All rights reserved.
 *
 * The license governing the contents of this file is located in the LICENSE
 * file located at the root directory of this distribution. If the LICENSE file
 * is missing, please contact sales@modolabs.com.
 *
 */
/**
 * @package Authentication
 */
Kurogo::includePackage('Authentication');
/**
 * @package Authentication
 */
abstract class Session
{
    const SESSION_GC_TIME = 21600;
    const TOKEN_COOKIE = 'lt';
    const USERHASH_COOKIE = 'lh';
    const API_TOKEN_COOKIE = 'alt';
    const API_USERHASH_COOKIE = 'alh';
    protected $session_id;
    protected $users = array();
    protected $login_token;
    protected $maxIdleTime = 0;
    protected $remainLoggedIn = false;
    protected $remainLoggedInTime = 0;
    protected $loginCookiePath;
Beispiel #9
0
<?php

define('MILES_PER_METER', 0.000621371192);
define('FEET_PER_METER', 3.2808399);
define('GEOGRAPHIC_PROJECTION', 4326);
define('EARTH_RADIUS_IN_METERS', 6378100);
define('EARTH_METERS_PER_DEGREE', 111319);
// very very rough
define('MAP_CATEGORY_DELIMITER', ':');
Kurogo::includePackage('Maps', 'Abstract');
Kurogo::includePackage('Maps', 'Base');
// http://en.wikipedia.org/wiki/Great-circle_distance
// chosen for what the page said about numerical accuracy
// but in practice the other formulas, i.e.
// law of cosines and haversine
// all yield pretty similar results
function greatCircleDistance($fromLat, $fromLon, $toLat, $toLon)
{
    $radiansPerDegree = M_PI / 180.0;
    $y1 = $fromLat * $radiansPerDegree;
    $x1 = $fromLon * $radiansPerDegree;
    $y2 = $toLat * $radiansPerDegree;
    $x2 = $toLon * $radiansPerDegree;
    $dx = $x2 - $x1;
    $cosDx = cos($dx);
    $cosY1 = cos($y1);
    $sinY1 = sin($y1);
    $cosY2 = cos($y2);
    $sinY2 = sin($y2);
    $leg1 = $cosY2 * sin($dx);
    $leg2 = $cosY1 * $sinY2 - $sinY1 * $cosY2 * $cosDx;
<?php

Kurogo::includePackage('Video');
class VideoAPIModule extends APIModule
{
    protected $id = 'video';
    // this affects which .ini is loaded
    protected $vmin = 1;
    protected $vmax = 1;
    protected $feeds = array();
    protected function arrayFromVideo($video)
    {
        return array("id" => $video->getID(), "title" => $video->getTitle(), "description" => strip_tags($video->getDescription()), "author" => $video->getAuthor(), "published" => $video->getPublished(), "date" => $video->getPublished()->format('M n, Y'), "url" => $video->getURL(), "image" => $video->getImage(), "width" => $video->getWidth(), "height" => $video->getHeight(), "duration" => $video->getDuration(), "tags" => $video->getTags(), "mobileURL" => $video->getMobileURL(), "streamingURL" => $video->getStreamingURL(), "stillFrameImage" => $video->getStillFrameImage());
    }
    protected function getFeed($feed = null)
    {
        $feed = isset($this->feeds[$feed]) ? $feed : $this->getDefaultSection();
        $feedData = $this->feeds[$feed];
        $controller = DataController::factory($feedData['CONTROLLER_CLASS'], $feedData);
        return $controller;
    }
    protected function getDefaultSection()
    {
        return key($this->feeds);
    }
    public function initializeForCommand()
    {
        $this->feeds = $this->loadFeedData();
        switch ($this->command) {
            case 'sections':
                $this->setResponse(VideoModuleUtils::getSectionsFromFeeds($this->feeds));
<?php

/*
 * Copyright © 2010 - 2013 Modo Labs Inc. All rights reserved.
 *
 * The license governing the contents of this file is located in the LICENSE
 * file located at the root directory of this distribution. If the LICENSE file
 * is missing, please contact sales@modolabs.com.
 *
 */
Kurogo::includePackage('UserContext');
class UserContext
{
    const CONTEXT_DEFAULT = '*';
    const RESOLUTION_TYPE_AUTO = 'auto';
    const RESOLUTION_TYPE_MANUAL = 'manual';
    protected $id;
    protected $title;
    protected $description;
    protected $rule;
    protected $active;
    public function isManual()
    {
        return $this->rule->getResolution() == self::RESOLUTION_TYPE_MANUAL;
    }
    public function isAuto()
    {
        return $this->rule->getResolution() == self::RESOLUTION_TYPE_AUTO;
    }
    public function getContextArgs()
    {
Beispiel #12
0
<?php

Kurogo::includePackage('Photos');
class PhotosAPIModule extends APIModule
{
    protected $id = 'photos';
    protected $vmin = 1;
    protected $vmax = 1;
    protected $feeds = array();
    protected function getFeed($feed)
    {
        if (!isset($this->feeds[$feed])) {
            throw new KurogoException(get_class($this) . ": Invalid Album id: {$feed}");
            return false;
        }
        $feedData = $this->feeds[$feed];
        $modelClass = isset($feedData['MODEL_CLASS']) ? $feedData['MODEL_CLASS'] : 'PhotosDataModel';
        $controller = DataModel::factory($modelClass, $feedData);
        return $controller;
    }
    public function initializeForCommand()
    {
        // don't know how to use version?
        $this->setResponseVersion(1);
        $this->feeds = $this->loadFeedData();
        switch ($this->command) {
            case 'albums':
                // get albums, output all available feeds
                $albums = array();
                foreach ($this->feeds as $id => $feed) {
                    $id = $feed['INDEX'];
Beispiel #13
0
 private function setPageVariables()
 {
     $this->loadTemplateEngineIfNeeded();
     $this->loadPageConfig();
     // Set variables common to all modules
     $this->assign('moduleID', $this->id);
     $this->assign('configModule', $this->configModule);
     $this->assign('templateModule', $this->templateModule);
     $this->assign('moduleName', $this->moduleName);
     $this->assign('page', $this->page);
     $this->assign('isModuleHome', $this->page == 'index');
     $this->assign('request_uri', $_SERVER['REQUEST_URI']);
     $this->assign('hideFooterLinks', $this->hideFooterLinks);
     $this->assign('ajaxContentLoad', $this->ajaxContentLoad);
     $this->assign('charset', Kurogo::getCharset());
     // Font size for template
     $this->assign('fontsizes', $this->fontsizes);
     $this->assign('fontsize', $this->fontsize);
     $this->assign('fontsizeCSS', $this->getFontSizeCSS());
     $this->assign('fontSizeURLs', $this->getFontSizeURLs());
     // Minify URLs
     $this->assign('minify', $this->getMinifyUrls());
     // Google Analytics. This probably needs to be moved
     if ($gaID = Kurogo::getOptionalSiteVar('GOOGLE_ANALYTICS_ID')) {
         $this->assign('GOOGLE_ANALYTICS_ID', $gaID);
         $this->assign('GOOGLE_ANALYTICS_DOMAIN', Kurogo::getOptionalSiteVar('GOOGLE_ANALYTICS_DOMAIN'));
         $this->assign('gaImageURL', $this->googleAnalyticsGetImageUrl($gaID));
     }
     // Percent Mobile Analytics
     if ($pmID = Kurogo::getOptionalSiteVar('PERCENT_MOBILE_ID')) {
         $this->assign('PERCENT_MOBILE_ID', $pmID);
         $pmBASEURL = "http://assets.percentmobile.com/percent_mobile.js";
         $this->assign('PERCENT_MOBILE_URL', $pmBASEURL);
         //$this->assign('pmImageURLJS', $this->percentMobileAnalyticsGetImageUrlJS($pmID));
         $this->assign('pmImageURL', $this->percentMobileAnalyticsGetImageUrl($pmID));
     }
     // Breadcrumbs
     $this->loadBreadcrumbs();
     // Tablet module nav list
     if ($this->pagetype == 'tablet' && $this->page != 'pane') {
         $this->addInternalJavascript('/common/javascript/lib/iscroll-4.0.js');
         $this->assign('moduleNavList', $this->getModuleNavlist());
     }
     Kurogo::log(LOG_DEBUG, "Calling initializeForPage for {$this->configModule} - {$this->page}", 'module');
     $this->initializeForPage();
     //subclass behavior
     Kurogo::log(LOG_DEBUG, "Returned from initializeForPage for {$this->configModule} - {$this->page}", 'module');
     // Set variables for each page
     $this->assign('pageTitle', $this->pageTitle);
     // Variables which may have been modified by the module subclass
     $this->assign('inlineCSSBlocks', $this->inlineCSSBlocks);
     $this->assign('cssURLs', $this->cssURLs);
     $this->assign('inlineJavascriptBlocks', $this->inlineJavascriptBlocks);
     $this->assign('onOrientationChangeBlocks', $this->onOrientationChangeBlocks);
     $this->assign('onLoadBlocks', $this->onLoadBlocks);
     $this->assign('inlineJavascriptFooterBlocks', $this->inlineJavascriptFooterBlocks);
     $this->assign('javascriptURLs', $this->javascriptURLs);
     $this->assign('breadcrumbs', $this->breadcrumbs);
     $this->assign('breadcrumbArgs', $this->getBreadcrumbArgs());
     $this->assign('breadcrumbSamePageArgs', $this->getBreadcrumbArgs(false));
     $this->assign('moduleDebugStrings', $this->moduleDebugStrings);
     $moduleStrings = $this->getOptionalModuleSection('strings');
     $this->assign('moduleStrings', $moduleStrings);
     $this->assign('homeLink', $this->buildURLForModule($this->getHomeModuleID(), '', array()));
     $this->assign('homeModuleID', $this->getHomeModuleID());
     $this->assignLocalizedStrings();
     // Module Help
     if ($this->page == 'help') {
         $this->assign('hasHelp', false);
         $template = 'common/templates/' . $this->page;
     } else {
         $this->assign('hasHelp', isset($moduleStrings['help']));
         $this->assign('helpLink', $this->buildBreadcrumbURL('help', array()));
         $this->assign('helpLinkText', $this->getLocalizedString('HELP_TEXT', $this->getModuleName()));
         $template = 'modules/' . $this->templateModule . '/templates/' . $this->templatePage;
     }
     Kurogo::log(LOG_DEBUG, "Template file is {$template}", 'module');
     // Pager support
     if (isset($this->htmlPager)) {
         $this->assign('pager', $this->getPager());
     }
     // Tab support
     if (isset($this->tabbedView)) {
         $this->assign('tabbedView', $this->tabbedView);
     }
     $this->assign('imageExt', $this->imageExt);
     $this->assign($this->getThemeVars());
     // Access Key Start
     $accessKeyStart = count($this->breadcrumbs);
     if ($this->configModule != $this->getHomeModuleID()) {
         $accessKeyStart++;
         // Home link
     }
     $this->assign('accessKeyStart', $accessKeyStart);
     if (Kurogo::getSiteVar('AUTHENTICATION_ENABLED')) {
         Kurogo::includePackage('Authentication');
         $this->setCacheMaxAge(0);
         $session = $this->getSession();
         $this->assign('session', $session);
         $this->assign('session_isLoggedIn', $this->isLoggedIn());
         $this->assign('showLogin', Kurogo::getSiteVar('AUTHENTICATION_ENABLED') && $this->showLogin());
         if ($this->isLoggedIn()) {
             $user = $session->getUser();
             $authority = $user->getAuthenticationAuthority();
             $this->assign('session_userID', $user->getUserID());
             $this->assign('session_fullName', $user->getFullname());
             if (count($session->getUsers()) == 1) {
                 $this->assign('session_logout_url', $this->buildURLForModule('login', 'logout', array('authority' => $user->getAuthenticationAuthorityIndex())));
                 $this->assign('footerLoginLink', $this->buildURLForModule('login', '', array()));
                 $this->assign('footerLoginText', $this->getLocalizedString('SIGNED_IN_SINGLE', $authority->getAuthorityTitle(), $user->getFullName()));
                 $this->assign('footerLoginClass', $authority->getAuthorityClass());
             } else {
                 $this->assign('footerLoginClass', 'login_multiple');
                 $this->assign('session_logout_url', $this->buildURLForModule('login', 'logout', array()));
                 $this->assign('footerLoginLink', $this->buildURLForModule('login', 'logout', array()));
                 $this->assign('footerLoginText', $this->getLocalizedString('SIGNED_IN_MULTIPLE'));
             }
             if ($session_max_idle = intval(Kurogo::getOptionalSiteVar('AUTHENTICATION_IDLE_TIMEOUT', 0))) {
                 $this->setRefresh($session_max_idle + 2);
             }
         } else {
             $this->assign('footerLoginClass', 'noauth');
             $this->assign('footerLoginLink', $this->buildURLForModule('login', '', array()));
             $this->assign('footerLoginText', $this->getLocalizedString('SIGN_IN_SITE', Kurogo::getSiteString('SITE_NAME')));
         }
     }
     /* set cache age. Modules that present content that rarely changes can set this value
        to something higher */
     header(sprintf("Cache-Control: max-age=%d", $this->cacheMaxAge));
     header("Expires: " . gmdate('D, d M Y H:i:s', time() + $this->cacheMaxAge) . ' GMT');
     return $template;
 }
Beispiel #14
0
 /**
  * Common initialization. Checks access.
  */
 protected function init()
 {
     if ($this->isDisabled()) {
         Kurogo::log(LOG_NOTICE, "Access to {$this->configModule} is disabled", 'module');
         $this->moduleDisabled();
     }
     $forceInsecure = $this->getOptionalModuleVar('FORCE_INSECURE', 0);
     $secureRequired = (Kurogo::sharedInstance()->getSite()->getRequiresSecure() || $this->getOptionalModuleVar('secure', false, 'module')) && !$forceInsecure;
     if ($secureRequired && !IS_SECURE) {
         Kurogo::log(LOG_NOTICE, "{$this->configModule} requires HTTPS", 'module');
         $this->secureModule();
     } elseif ($this->getConfigModule() == Kurogo::sharedInstance()->getCurrentModuleID() && !$secureRequired && IS_SECURE && $forceInsecure) {
         $this->unsecureModule();
     }
     if (Kurogo::getSiteVar('AUTHENTICATION_ENABLED')) {
         Kurogo::includePackage('Authentication');
         if (!$this->getAccess()) {
             $this->unauthorizedAccess();
         }
     }
     $this->logView = Kurogo::getOptionalSiteVar('STATS_ENABLED', true) ? true : false;
 }
Beispiel #15
0
 public static function factory($retrieverClass, $args)
 {
     Kurogo::log(LOG_DEBUG, "Initializing DataRetriever {$retrieverClass}", "data");
     if (isset($args['PACKAGE'])) {
         Kurogo::includePackage($args['PACKAGE']);
     }
     if (!class_exists($retrieverClass)) {
         throw new KurogoConfigurationException("Retriever class {$retrieverClass} not defined");
     }
     $retriever = new $retrieverClass();
     if (!$retriever instanceof DataRetriever) {
         throw new KurogoConfigurationException(get_class($retriever) . " is not a subclass of DataRetriever");
     }
     $retriever->setDebugMode(Kurogo::getSiteVar('DATA_DEBUG'));
     $retriever->init($args);
     return $retriever;
 }
Beispiel #16
0
 /**
  * Common initialization. Checks access.
  */
 protected function init()
 {
     if ($this->isDisabled()) {
         Kurogo::log(LOG_NOTICE, "Access to {$this->configModule} is disabled", 'module');
         $this->moduleDisabled();
     }
     if ((Kurogo::getOptionalSiteVar('SECURE_REQUIRED') || $this->getModuleVar('secure', 'module')) && (!isset($_SERVER['HTTPS']) || strtolower($_SERVER['HTTPS']) != 'on')) {
         Kurogo::log(LOG_NOTICE, "{$this->configModule} requires HTTPS", 'module');
         $this->secureModule();
     }
     if (Kurogo::getSiteVar('AUTHENTICATION_ENABLED')) {
         Kurogo::includePackage('Authentication');
         if (!$this->getAccess()) {
             $this->unauthorizedAccess();
         }
     }
     $this->logView = Kurogo::getOptionalSiteVar('STATS_ENABLED', true) ? true : false;
 }
Beispiel #17
0
 private function setPageVariables()
 {
     $this->loadTemplateEngineIfNeeded();
     $this->loadPageConfig();
     // Set variables common to all modules
     $this->assign('moduleID', $this->id);
     $this->assign('configModule', $this->configModule);
     $this->assign('templateModule', $this->templateModule);
     $this->assign('moduleName', $this->moduleName);
     $this->assign('navImageID', $this->getModuleIcon());
     $this->assign('page', $this->page);
     $this->assign('isModuleHome', $this->page == 'index');
     $this->assign('request_uri', $_SERVER['REQUEST_URI']);
     $this->assign('hideFooterLinks', $this->hideFooterLinks);
     $this->assign('ajaxContentLoad', $this->ajaxContentLoad);
     $this->assign('charset', Kurogo::getCharset());
     $this->assign('http_protocol', HTTP_PROTOCOL);
     $this->assign('webBridgeAjaxContentLoad', KurogoWebBridge::isAjaxContentLoad());
     // Font size for template
     $this->assign('fontsizes', $this->fontsizes);
     $this->assign('fontsize', $this->fontsize);
     $this->assign('fontsizeCSS', $this->getFontSizeCSS());
     $this->assign('fontSizeURLs', $this->getFontSizeURLs());
     // Minify URLs
     $this->assign('minify', $this->getMinifyUrls());
     // Google Analytics. This probably needs to be moved
     if ($gaID = Kurogo::getOptionalSiteVar('GOOGLE_ANALYTICS_ID')) {
         $this->assign('GOOGLE_ANALYTICS_ID', $gaID);
         $this->assign('GOOGLE_ANALYTICS_DOMAIN', Kurogo::getOptionalSiteVar('GOOGLE_ANALYTICS_DOMAIN'));
         $this->assign('gaImageURL', $this->googleAnalyticsGetImageUrl($gaID));
     }
     // Breadcrumbs
     $this->loadBreadcrumbs();
     // Tablet iScroll
     if ($this->pagetype == 'tablet') {
         $this->addInternalJavascript('/common/javascript/lib/iscroll-4.2.js');
         // Module nav list
         if ($this->shouldShowNavigation()) {
             $this->assign('navigationModules', $this->getModuleNavlist());
             $allowCustomize = Kurogo::getOptionalModuleVar('ALLOW_CUSTOMIZE', true, $this->getHomeModuleID());
             $this->assignUserContexts($allowCustomize);
         }
     }
     if ($this->page == self::WEB_BRIDGE_BUILD_TEMPLATES_PAGE) {
         $title = 'Error!';
         $message = '';
         try {
             if (!Kurogo::isLocalhost()) {
                 throw new KurogoException("{$this->page} command can only be run from localhost");
             }
             $platforms = array_filter(array_map('trim', explode(',', $this->getArg('platform', ''))));
             if (!$platforms) {
                 throw new KurogoException("No platforms specified");
             }
             foreach ($platforms as $platform) {
                 $this->buildNativeWebTemplatesForPlatform($platform);
             }
             $title = 'Success!';
             $message = 'Generated native web templates for ' . implode(' and ', $platforms);
         } catch (Exception $e) {
             $message = $e->getMessage();
         }
         $this->assign('contentTitle', $title);
         $this->assign('contentBody', $message);
     } else {
         if (KurogoWebBridge::useNativeTemplatePageInitializer()) {
             Kurogo::log(LOG_DEBUG, "Calling initializeForNativeTemplatePage for {$this->configModule} - {$this->page}", 'module');
             $this->initializeForNativeTemplatePage();
             //subclass behavior
             Kurogo::log(LOG_DEBUG, "Returned from initializeForNativeTemplatePage for {$this->configModule} - {$this->page}", 'module');
         } else {
             Kurogo::log(LOG_DEBUG, "Calling initializeForPage for {$this->configModule} - {$this->page}", 'module');
             $this->initializeForPage();
             //subclass behavior
             Kurogo::log(LOG_DEBUG, "Returned from initializeForPage for {$this->configModule} - {$this->page}", 'module');
         }
     }
     // Set variables for each page
     $this->assign('pageTitle', $this->pageTitle);
     // Variables which may have been modified by the module subclass
     $this->assign('inlineCSSBlocks', $this->inlineCSSBlocks);
     $this->assign('cssURLs', $this->cssURLs);
     $this->assign('inlineJavascriptBlocks', $this->inlineJavascriptBlocks);
     $this->assign('onOrientationChangeBlocks', $this->onOrientationChangeBlocks);
     $this->assign('onLoadBlocks', $this->onLoadBlocks);
     $this->assign('inlineJavascriptFooterBlocks', $this->inlineJavascriptFooterBlocks);
     $this->assign('javascriptURLs', $this->javascriptURLs);
     $this->assign('breadcrumbs', $this->breadcrumbs);
     $this->assign('breadcrumbArgs', $this->getBreadcrumbArgs());
     $this->assign('breadcrumbSamePageArgs', $this->getBreadcrumbArgs(false));
     $this->assign('breadcrumbsShowAll', $this->getOptionalThemeVar('breadcrumbs_show', true));
     if (Kurogo::getSiteVar('MODULE_DEBUG')) {
         $this->addModuleDebugString('Config Mode', implode(', ', Kurogo::sharedInstance()->getConfigModes()));
         $this->addModuleDebugString('Version', KUROGO_VERSION);
         if (SITE_VERSION) {
             $this->addModuleDebugString('Site Version', SITE_VERSION);
         }
         if (SITE_BUILD) {
             $this->addModuleDebugString('Site Build', SITE_BUILD);
         }
         if ($contexts = Kurogo::sharedInstance()->getActiveContexts()) {
             $this->addModuleDebugString('Context(s)', implode(', ', $contexts));
         }
         $this->assign('moduleDebugStrings', $this->moduleDebugStrings);
     }
     $this->assign('webBridgeOnPageLoadParams', KurogoWebBridge::getOnPageLoadParams($this->pageTitle, $this->breadcrumbTitle, $this->hasWebBridgePageRefresh, $this->hasWebBridgeAutoRefresh));
     $this->assign('webBridgeOnPageLoadConfig', KurogoWebBridge::getOnPageLoadConfig());
     $this->assign('webBridgeConfig', KurogoWebBridge::getServerConfig($this->configModule, $this->page, $this->args));
     $moduleStrings = $this->getOptionalModuleSection('strings');
     $this->assign('moduleStrings', $moduleStrings);
     $this->assign('homeLink', $this->buildURLForModule($this->getHomeModuleID(), '', array()));
     $this->assign('homeModuleID', $this->getHomeModuleID());
     $this->assignLocalizedStrings();
     if ($this->page == 'help') {
         // Module Help
         $this->assign('hasHelp', false);
         $template = 'common/templates/' . $this->page;
     } else {
         if ($this->page == self::WEB_BRIDGE_BUILD_TEMPLATES_PAGE) {
             $template = 'common/templates/staticContent';
         } else {
             if (KurogoWebBridge::useWrapperPageTemplate()) {
                 // Web bridge page wrapper
                 $template = 'common/templates/webBridge';
                 $this->assign('webBridgeJSLocalizedStrings', json_encode(Kurogo::getLocalizedStrings()));
             } else {
                 $this->assign('hasHelp', isset($moduleStrings['help']));
                 $this->assign('helpLink', $this->buildBreadcrumbURL('help', array()));
                 $this->assign('helpLinkText', $this->getLocalizedString('HELP_TEXT', $this->getModuleName()));
                 $template = 'modules/' . $this->templateModule . '/templates/' . $this->templatePage;
             }
         }
     }
     Kurogo::log(LOG_DEBUG, "Template file is {$template}", 'module');
     // Pager support
     if (isset($this->htmlPager)) {
         $this->assign('pager', $this->getPager());
     }
     // Tab support
     if (isset($this->tabbedView)) {
         $this->assign('tabbedView', $this->tabbedView);
     }
     $this->assign('imageExt', $this->imageExt);
     $this->assign(Kurogo::getThemeVars());
     // Access Key Start
     $accessKeyStart = count($this->breadcrumbs);
     if ($this->configModule != $this->getHomeModuleID()) {
         $accessKeyStart++;
         // Home link
     }
     $this->assign('accessKeyStart', $accessKeyStart);
     if (Kurogo::getSiteVar('AUTHENTICATION_ENABLED')) {
         Kurogo::includePackage('Authentication');
         $this->setCacheMaxAge(0);
         $session = $this->getSession();
         $this->assign('session', $session);
         $this->assign('session_isLoggedIn', $this->isLoggedIn());
         $this->assign('showLogin', Kurogo::getSiteVar('AUTHENTICATION_ENABLED') && $this->showLogin());
         if ($this->isLoggedIn()) {
             $user = $session->getUser();
             $authority = $user->getAuthenticationAuthority();
             $this->assign('session_userID', $user->getUserID());
             $this->assign('session_fullName', $user->getFullname());
             if (count($session->getUsers()) == 1) {
                 $this->assign('session_logout_url', $this->buildURLForModule($this->getLoginModuleID(), 'logout', array('authority' => $user->getAuthenticationAuthorityIndex())));
                 $this->assign('footerLoginLink', $this->buildURLForModule($this->getLoginModuleID(), '', array()));
                 $this->assign('footerLoginText', $this->getLocalizedString('SIGNED_IN_SINGLE', $authority->getAuthorityTitle(), $user->getFullName()));
                 $this->assign('footerLoginClass', $authority->getAuthorityClass());
             } else {
                 $this->assign('footerLoginClass', 'login_multiple');
                 $this->assign('session_logout_url', $this->buildURLForModule($this->getLoginModuleID(), 'logout', array()));
                 $this->assign('footerLoginLink', $this->buildURLForModule($this->getLoginModuleID(), 'logout', array()));
                 $this->assign('footerLoginText', $this->getLocalizedString('SIGNED_IN_MULTIPLE'));
             }
             if ($session_max_idle = intval(Kurogo::getOptionalSiteVar('AUTHENTICATION_IDLE_TIMEOUT', 0))) {
                 $this->setRefresh($session_max_idle + 60);
             }
         } else {
             $this->assign('footerLoginClass', 'noauth');
             $this->assign('footerLoginLink', $this->buildURLForModule($this->getLoginModuleID(), '', array()));
             $this->assign('footerLoginText', $this->getLocalizedString('SIGN_IN_SITE', Kurogo::getSiteString('SITE_NAME')));
         }
     }
     /* set cache age. Modules that present content that rarely changes can set this value
        to something higher */
     header(sprintf("Cache-Control: max-age=%d", $this->cacheMaxAge));
     /*
      * Date is set by apache (or your webserver of choice).  Under apache, and possibly other
      * webservers, it is impossible to either manually set this header or read the value of it.
      * Here, we want to set the Expires header such that disable caching.  One method of doing
      * this is to set Expires to the same value as Date.
      * Because of execution time up to this point, very occasionally these two values are off by
      * 1 second.  The net result is that with a $this->cacheMaxAge of 0, the Date and Expires
      * headers are different by 1 second.  Combined with Pragma: no-cache and
      * Cache-Control: no-cache, you get conflicting behavior which can (in theory) be exploited.
      * It also causes security tools to complain about the difference.
      *
      * The only reliable thing to do when explicitly attempting to avoid caching is to set
      * Expires to a time in the past. The best way to do that is to set it to Unix epoch.
      */
     if ($this->cacheMaxAge > 0) {
         header("Expires: " . gmdate('D, d M Y H:i:s', time() + $this->cacheMaxAge) . ' GMT');
     } else {
         header("Expires: " . gmdate('D, d M Y H:i:s', 0) . ' GMT');
     }
     return $template;
 }
Beispiel #18
0
<?php

/*
 * Copyright © 2010 - 2012 Modo Labs Inc. All rights reserved.
 *
 * The license governing the contents of this file is located in the LICENSE
 * file located at the root directory of this distribution. If the LICENSE file
 * is missing, please contact sales@modolabs.com.
 *
 */
Kurogo::includePackage('Maps');
class MapWebModule extends WebModule
{
    protected $id = 'map';
    protected $mapURL = null;
    protected $feedGroup = null;
    protected $feedGroups = null;
    protected $dataModel = null;
    protected $numGroups;
    protected $feeds;
    protected $placemarkId;
    protected $mapDevice = null;
    protected $selectedPlacemarks;
    protected $redirectSearch = true;
    // whether or not to redirect to detail page if there is one search result
    ////// inherited and conventional module functions
    public function getFeedGroups()
    {
        return $this->getModuleSections('feedgroups');
    }
    // overrides function in Module.php
Beispiel #19
0
 * Copyright © 2010 - 2013 Modo Labs Inc. All rights reserved.
 *
 * The license governing the contents of this file is located in the LICENSE
 * file located at the root directory of this distribution. If the LICENSE file
 * is missing, please contact sales@modolabs.com.
 *
 */
/**
 * Oracle database abstraction
 * @package Database
 */
/**
 * Oracle database abstraction
 * @package Database
 */
Kurogo::includePackage('db', 'oci8');
class db_oci8 extends db
{
    public static function connection($dsn_data)
    {
        if (!isset($dsn_data['DB_HOST']) || empty($dsn_data['DB_HOST'])) {
            throw new KurogoConfigurationException("Oracle host not specified");
        }
        if (!isset($dsn_data['DB_USER']) || empty($dsn_data['DB_USER'])) {
            throw new KurogoConfigurationException("Oracle user not specified");
        }
        if (!isset($dsn_data['DB_PASS']) || empty($dsn_data['DB_PASS'])) {
            throw new KurogoConfigurationException("Oracle password not specified");
        }
        if (!isset($dsn_data['DB_DBNAME']) || empty($dsn_data['DB_DBNAME'])) {
            throw new KurogoConfigurationException("Oracle database not specified");
Beispiel #20
0
<?php

Kurogo::includePackage('Emergency');
class EmergencyAPIModule extends APIModule
{
    protected $id = 'emergency';
    protected $vmin = 1;
    protected $vmax = 2;
    protected function initializeForCommand()
    {
        $config = $this->getConfig('feeds');
        switch ($this->command) {
            case 'notice':
                if ($noticeConfig = $config->getOptionalSection('notice')) {
                    try {
                        if (isset($noticeConfig['CONTROLLER_CLASS'])) {
                            $modelClass = $noticeConfig['CONTROLLER_CLASS'];
                        } else {
                            $modelClass = isset($noticeConfig['MODEL_CLASS']) ? $noticeConfig['MODEL_CLASS'] : 'EmergencyNoticeDataModel';
                        }
                        $emergencyNoticeController = EmergencyNoticeDataModel::factory($modelClass, $noticeConfig);
                    } catch (KurogoException $e) {
                        $emergencyNoticeController = DataController::factory($noticeConfig['CONTROLLER_CLASS'], $noticeConfig);
                    }
                    $emergencyNotice = $emergencyNoticeController->getFeaturedEmergencyNotice();
                    $noticeEnabled = true;
                } else {
                    // Config section 'notice' not set, there is not notice
                    $emergencyNotice = null;
                    $noticeEnabled = false;
                }
Beispiel #21
0
<?php

Kurogo::includePackage('Authorization');
abstract class OAuthAuthentication extends AuthenticationAuthority
{
    protected $OAuthProviderClass;
    protected $OAuthProvider;
    protected abstract function getUserFromArray(array $array);
    protected function validUserLogins()
    {
        return array('LINK', 'NONE');
    }
    protected function auth($login, $password, &$user)
    {
        return AUTH_FAILED;
    }
    //does not support groups
    public function getGroup($group)
    {
        return false;
    }
    public function login($login, $pass, Session $session, $options)
    {
        $oauth = $this->getOAuthProvider();
        $result = $oauth->auth($options, $userArray);
        if ($result == AUTH_OK) {
            if ($user = $this->getUserFromArray($userArray)) {
                $oauth->saveTokenForUser($user);
                $session->login($user);
            } else {
                $result = AUTH_FAILED;
Beispiel #22
0
function includePackage($packageName, $subpackageName = null)
{
    Kurogo::includePackage($packageName, $subpackageName);
}
Beispiel #23
0
 protected function detectDeviceInternal($user_agent)
 {
     Kurogo::log(LOG_INFO, "Detecting device using internal device detection", 'deviceDetection');
     if (!$user_agent) {
         return;
     }
     /*
      * Two things here:
      * First off, we now have two files which can be used to classify devices,
      * the master file, usually at LIB_DIR/deviceData.json, and the custom file,
      * usually located at DATA_DIR/deviceData.json.
      *
      * Second, we're still allowing the use of sqlite databases (despite it
      * being slower and more difficult to update).  So, if you specify the
      * format of the custom file as sqlite, it should still work.
      */
     $master_file = LIB_DIR . "/deviceData.json";
     $site_file = Kurogo::getOptionalSiteVar('MOBI_SERVICE_SITE_FILE');
     $site_file_format = Kurogo::getOptionalSiteVar('MOBI_SERVICE_SITE_FORMAT', 'json');
     if (!($site_file && $site_file_format)) {
         // We don't have a site-specific file.  This means we can only
         // detect on the master file.
         $site_file = "";
     }
     if (!empty($site_file) && ($site_file = realpath_exists($site_file))) {
         switch ($site_file_format) {
             case 'json':
                 $site_devices = json_decode(file_get_contents($site_file), true);
                 $site_devices = $site_devices['devices'];
                 if (($error_code = json_last_error()) !== JSON_ERROR_NONE) {
                     throw new KurogoConfigurationException("Problem decoding Custom Device Detection File. Error code returned was " . $error_code);
                 }
                 if (($device = $this->checkDevices($site_devices, $user_agent)) !== false) {
                     return $this->translateDevice($device);
                 }
                 break;
             case 'sqlite':
                 Kurogo::includePackage('db');
                 try {
                     $db = new db(array('DB_TYPE' => 'sqlite', 'DB_FILE' => $site_file));
                     $result = $db->query('SELECT * FROM userAgentPatterns WHERE version<=? ORDER BY patternorder,version DESC', array($this->version));
                 } catch (Exception $e) {
                     Kurogo::log(LOG_ALERT, "Error with internal device detection: " . $e->getMessage(), 'deviceDetection');
                     if (!in_array('sqlite', PDO::getAvailableDrivers())) {
                         die("SQLite PDO drivers not available. You should switch to external device detection by changing MOBI_SERVICE_USE_EXTERNAL to 1 in " . SITE_CONFIG_DIR . "/site.ini");
                     }
                     return false;
                 }
                 while ($row = $result->fetch()) {
                     if (preg_match("#" . $row['pattern'] . "#i", $user_agent)) {
                         return $row;
                     }
                 }
                 break;
             default:
                 throw new KurogoConfigurationException('Unknown format specified for Custom Device Detection File: ' . $site_file_format);
         }
     }
     if (!empty($master_file) && ($master_file = realpath_exists($master_file))) {
         $master_devices = json_decode(file_get_contents($master_file), true);
         $master_devices = $master_devices['devices'];
         if (function_exists('json_last_error') && ($error_code = json_last_error()) !== JSON_ERROR_NONE) {
             Kurogo::log(LOG_ALERT, "Error with JSON internal device detection: " . $error_code, 'deviceDetection');
             die("Problem decoding Device Detection Master File. Error code returned was " . $error_code);
         }
         if (($device = $this->checkDevices($master_devices, $user_agent)) !== false) {
             return $this->translateDevice($device);
         }
     }
     Kurogo::log(LOG_WARNING, "Could not find a match in the internal device detection database for: {$user_agent}", 'deviceDetection');
 }
<?php

/**
 * @package Module
 * @subpackage Calendar
 */
Kurogo::includePackage('Calendar');
define('DAY_SECONDS', 24 * 60 * 60);
/**
 * @package Module
 * @subpackage Calendar
 */
class CalendarWebModule extends WebModule
{
    protected $id = 'calendar';
    protected $feeds = array();
    protected $timezone;
    protected function getTitleForSearchOptions($intervalType, $offset, $forward = true)
    {
        if ($offset < 0) {
            $relation = $this->getLocalizedString("SEARCH_RANGE_PREVIOUS");
            $offset = -$offset;
        } else {
            $relation = $this->getLocalizedString("SEARCH_RANGE_NEXT");
        }
        switch ($intervalType) {
            case 'day':
                if ($offset == 1) {
                    $result = $this->getLocalizedString("SEARCH_RANGE_TITLE_DAY", $relation);
                } else {
                    $result = $this->getLocalizedString("SEARCH_RANGE_TITLE_MULTIDAY", $relation, strval($offset));
<?php

/*
 * Copyright © 2010 - 2013 Modo Labs Inc. All rights reserved.
 *
 * The license governing the contents of this file is located in the LICENSE
 * file located at the root directory of this distribution. If the LICENSE file
 * is missing, please contact sales@modolabs.com.
 *
 */
/**
 * @package People
 */
Kurogo::includePackage('LDAP');
if (!function_exists('ldap_connect')) {
    throw new KurogoException('LDAP PHP extension is not installed');
}
// common ldap error codes
define("LDAP_TIMELIMIT_EXCEEDED", 0x3);
define("LDAP_SIZELIMIT_EXCEEDED", 0x4);
define("LDAP_PARTIAL_RESULTS", 0x9);
define("LDAP_ADMINLIMIT_EXCEEDED", 0xb);
define("LDAP_INSUFFICIENT_ACCESS", 0x32);
/**
 * @package People
 */
class LDAPPeopleRetriever extends DataRetriever implements PeopleRetriever
{
    const MIN_NAME_SEARCH = 3;
    protected $DEFAULT_PARSER_CLASS = 'LDAPPeopleParser';
    protected $MIN_PHONE_SEARCH = PeopleRetriever::MIN_PHONE_SEARCH;