public function display() { $json = $this->getJSONOutput(); $size = strlen($json); header("Content-Type: application/json; charset=" . Kurogo::getCharset()); header("Content-Length: " . $size); echo $json; return $json; }
public static function debug($val = '', $halt = false, $trace = true) { $plain = false; if ($halt && !headers_sent()) { $plain = true; header('Content-type: text/plain; charset=' . Kurogo::getCharset()); } $line_break = PHP_SAPI == 'cli' || $plain ? PHP_EOL : PHP_EOL . "<br />" . PHP_EOL; $output = ''; if ($trace) { $output .= implode($line_break, self::compactTrace(debug_backtrace())) . $line_break . $line_break; } if ($val || $val === 0) { if (PHP_SAPI != 'cli' && !is_scalar($val) && ini_get('html_errors') != 'off') { if (!$halt) { $output .= "<pre>" . PHP_EOL; } if (is_array($val)) { $output .= count($val) . ": "; } $output .= print_r($val, true); if (!$halt) { $output .= PHP_EOL . "</pre>"; } } else { if (is_array($val)) { $output .= count($val) . ": "; } $output .= print_r($val, true); } $output .= $line_break; } else { $output .= "(empty " . gettype($val) . ")"; $output .= $line_break; } print $output; if ($halt) { die; } }
protected function headers() { $headers = parent::headers(); //if the first parameter is true then exclude the authorization headers $args = func_get_args(); if (isset($args[0]) && $args[0]) { return $headers; } switch ($this->method()) { case 'GET': break; case 'POST': $headers['Content-type'] = 'application/x-www-form-urlencoded; charset=' . Kurogo::getCharset(); break; } $headers['Authorization'] = $this->getAuthorizationHeader(); $headers['Expect'] = ''; return $headers; }
function exceptionHandlerForDevelopment(Exception $exception) { $bt = $exception->getTrace(); array_unshift($bt, array('line' => $exception->getLine(), 'file' => $exception->getFile())); Kurogo::log(LOG_ALERT, "A " . get_class($exception) . " has occured: " . $exception->getMessage(), "exception", $bt); $errtime = developmentErrorLog($exception); $error = print_r($exception, TRUE); if ($url = getErrorURL($exception, $errtime)) { Kurogo::redirectToURL($url); } else { header('Content-type: text/plain; charset=' . Kurogo::getCharset()); die("A serious error has occurred: \n\n" . $error); } }
public function __doRequest($request, $location, $action, $version, $one_way = 0) { //use curl if there is auth if ($this->auth) { $headers = array('Content-Type: text/xml; charset=' . Kurogo::getCharset()); $ch = curl_init($location); if (!$this->ssl_verify) { curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); } curl_setopt($ch, CURLOPT_HTTPAUTH, $this->auth); curl_setopt($ch, CURLOPT_USERPWD, $this->cred); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $request); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); $result = curl_exec($ch); Kurogo::log(LOG_WARNING, "SOAP result: {$result}, {$location}", 'soap'); return $result; } else { return parent::__doRequest($request, $location, $action, $version, $one_way); } }
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; }
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; }
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; }
public function __doRequest($request, $location, $action, $version, $one_way = 0) { $location = $this->getRequestLocation($location); //use curl if there is auth if ($this->useCurl) { $headers = array('Content-Type: text/xml; charset=' . Kurogo::getCharset()); $ch = curl_init($location); foreach ($this->initArgs as $key => $value) { if (preg_match("/CURLOPT_/", $key)) { curl_setopt($ch, constant($key), $value); } } if ($this->authUser) { curl_setopt($ch, CURLOPT_HTTPAUTH, constant('CURLAUTH_' . strtoupper($this->authType))); curl_setopt($ch, CURLOPT_USERPWD, $this->authUser . ':' . $this->authPassword); } curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $request); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); //curl_setopt($ch, CURLINFO_HEADER_OUT, true); $result = curl_exec($ch); Kurogo::log(LOG_WARNING, "SOAP result: {$result}, {$location}", 'soap'); return $result; } else { return parent::__doRequest($request, $location, $action, $version, $one_way); } }