/** * Returns news for the dashboard (if a new version is available). * * @return html */ public static function getNews() { $systemInfoDb = new SystemInfo(); $systemInfo = $systemInfoDb->getSystemInfo(); /* Update daily. */ $lastWeeksDate = time() - SECONDS_IN_A_DAY; $lastCheck = strtotime($systemInfo['date_version_checked']); if ($lastWeeksDate > $lastCheck) { self::checkForUpdate(); /* Refresh the new information. */ $systemInfo = $systemInfoDb->getSystemInfo(); } /* Only display new version news if a new version is available. */ if ($systemInfo['available_version'] > CATSUtility::getVersionAsInteger()) { return urldecode($systemInfo['available_version_description']); } return ''; }
/** * Prints logo and "top-right" header HTML. * * @return void */ public static function printHeaderBlock($showTopRight = true) { $username = $_SESSION['CATS']->getUsername(); $siteName = $_SESSION['CATS']->getSiteName(); $fullName = $_SESSION['CATS']->getFullName(); $indexName = CATSUtility::getIndexName(); echo '<div id="headerBlock">', "\n"; /* CATS Logo */ echo '<table cellspacing="0" cellpadding="0" style="margin: 0px; padding: 0px; float: left;">', "\n"; echo '<tr>', "\n"; echo '<td rowspan="2"><img src="images/applicationLogo.jpg" border="0" alt="CATS Applicant Tracking System" /></td>', "\n"; echo '</tr>', "\n"; echo '</table>', "\n"; if (!eval(Hooks::get('TEMPLATE_LIVE_CHAT'))) { return; } if (!eval(Hooks::get('TEMPLATE_LOGIN_INFO_PRE_TOP_RIGHT'))) { return; } if ($showTopRight) { // FIXME: Use common functions. // FIXME: Isn't the UNIX-name stuff ASP specific? Hook? if (strpos($username, '@' . $_SESSION['CATS']->getSiteID()) !== false && substr($username, strpos($username, '@' . $_SESSION['CATS']->getSiteID())) == '@' . $_SESSION['CATS']->getSiteID()) { $username = str_replace('@' . $_SESSION['CATS']->getSiteID(), '', $username); } if (!eval(Hooks::get('TEMPLATE_LOGIN_INFO_TOP_RIGHT_1'))) { return; } /* Top Right Corner */ echo '<div id="topRight">', "\n"; echo '<div style="padding-bottom: 8px;">'; // Begin top-right action block if (!eval(Hooks::get('TEMPLATE_LOGIN_INFO_TOP_RIGHT_UPGRADE'))) { return; } if ((!file_exists('modules/asp') || defined('CATS_TEST_MODE') && CATS_TEST_MODE) && LicenseUtility::isProfessional() && $_SESSION['CATS']->getAccessLevel() >= ACCESS_LEVEL_SA) { if (abs(LicenseUtility::getExpirationDate() - time()) < 60 * 60 * 24 * 30) { $daysLeft = abs(LicenseUtility::getExpirationDate() - time()) / 60 / 60 / 24; echo '<a href="http://www.catsone.com/professional" target="_blank">'; echo '<img src="images/tabs/small_upgrade.jpg" border="0" /> '; echo 'License expires in ' . number_format($daysLeft, 0) . ' days, Renew?</a> ', "\n"; } else { echo '<a href="http://www.catsone.com/professional" target="_blank">'; echo '<img src="images/tabs/small_upgrade.jpg" border="0" /> '; echo 'CATS Professional Account Login</a> ', "\n"; } } if (!file_exists('modules/asp') && !LicenseUtility::isProfessional()) { echo '<a href="http://www.catsone.com/professional" target="_blank">'; echo '<img src="images/tabs/small_upgrade.jpg" border="0" /> '; echo '<b>For more features, upgrade to CATS Professional</b></a> ', "\n"; } echo '<a href="', $indexName, '?m=logout">'; echo '<img src="images/tabs/small_logout.jpg" border="0" /> '; echo 'Logout</a>', "\n"; echo '</div>', "\n"; // End top-right action block if (!eval(Hooks::get('TEMPLATE_LOGIN_INFO_EXTENDED_SITE_NAME'))) { return; } echo '<span>', $fullName, ' <', $username, '> (', $siteName, ')</span>', "\n"; if ($_SESSION['CATS']->getAccessLevel() >= ACCESS_LEVEL_SA) { echo ' <span style="font-weight:bold;">Administrator</span>', "\n"; } echo '<br />'; $systemInfo = new SystemInfo(); $systemInfoData = $systemInfo->getSystemInfo(); if (isset($systemInfoData['available_version']) && $systemInfoData['available_version'] > CATSUtility::getVersionAsInteger() && isset($systemInfoData['disable_version_check']) && !$systemInfoData['disable_version_check'] && $_SESSION['CATS']->getAccessLevel() >= ACCESS_LEVEL_SA) { echo '<a href="http://www.catsone.com/download.php" target="catsdl">A new CATS version is available!</a><br />'; } /* Disabled notice */ if (!$_SESSION['CATS']->accountActive()) { echo '<span style="font-weight:bold;">Account Inactive</span><br />', "\n"; } else { if ($_SESSION['CATS']->getAccessLevel() == ACCESS_LEVEL_READ) { echo '<span>Read Only Access</span><br />', "\n"; } else { if (!eval(Hooks::get('TEMPLATE_LOGIN_INFO_TOP_RIGHT_2_ELSE'))) { return; } } } echo '</div>', "\n"; } echo '</div>', "\n"; }
private function administration() { /* Bail out if the user doesn't have SA permissions. */ if ($this->_realAccessLevel < ACCESS_LEVEL_DEMO && !$_SESSION['CATS']->hasUserCategory('careerportal')) { CommonErrors::fatal(COMMONERROR_PERMISSION, $this); } $systemInfo = new SystemInfo(); $systemInfoData = $systemInfo->getSystemInfo(); if (isset($systemInfoData['available_version']) && $systemInfoData['available_version'] > CATSUtility::getVersionAsInteger()) { $newVersion = true; } else { $newVersion = false; } if (isset($systemInfoData['disable_version_check']) && $systemInfoData['disable_version_check']) { $versionCheckPref = false; } else { $versionCheckPref = true; } if ($this->_realAccessLevel >= ACCESS_LEVEL_ROOT || $this->_realAccessLevel == ACCESS_LEVEL_DEMO) { $systemAdministration = true; } else { $systemAdministration = false; } // FIXME: 's' isn't a good variable name. if (isset($_GET['s'])) { switch ($_GET['s']) { case 'siteName': $templateFile = './modules/settings/SiteName.tpl'; break; case 'newVersionCheck': if (!$systemAdministration) { CommonErrors::fatal(COMMONERROR_PERMISSION, $this); return; //$this->fatal(ERROR_NO_PERMISSION); } $this->_template->assign('versionCheckPref', $versionCheckPref); $this->_template->assign('availableVersion', $systemInfoData['available_version']); $this->_template->assign('newVersion', $newVersion); $this->_template->assign('newVersionNews', NewVersionCheck::getNews()); $templateFile = './modules/settings/NewVersionCheck.tpl'; break; case 'passwords': if (!$systemAdministration) { CommonErrors::fatal(COMMONERROR_PERMISSION, $this); return; //$this->fatal(ERROR_NO_PERMISSION); } $templateFile = './modules/settings/Passwords.tpl'; break; case 'localization': if ($this->_realAccessLevel < ACCESS_LEVEL_SA) { CommonErrors::fatal(COMMONERROR_PERMISSION, $this); return; //$this->fatal(ERROR_NO_PERMISSION); } $this->_template->assign('timeZone', $_SESSION['CATS']->getTimeZone()); $this->_template->assign('isDateDMY', $_SESSION['CATS']->isDateDMY()); $templateFile = './modules/settings/Localization.tpl'; break; case 'systemInformation': if ($this->_realAccessLevel < ACCESS_LEVEL_SA) { CommonErrors::fatal(COMMONERROR_PERMISSION, $this); return; //$this->fatal(ERROR_NO_PERMISSION); } $db = DatabaseConnection::getInstance(); $databaseVersion = $db->getRDBMSVersion(); $installationDirectory = realpath('./'); if (SystemUtility::isWindows()) { $OSType = 'Windows'; } else { if (SystemUtility::isMacOSX()) { $OSType = 'Mac OS X'; } else { $OSType = 'UNIX'; } } $schemaVersions = ModuleUtility::getModuleSchemaVersions(); $this->_template->assign('databaseVersion', $databaseVersion); $this->_template->assign('installationDirectory', $installationDirectory); $this->_template->assign('OSType', $OSType); $this->_template->assign('schemaVersions', $schemaVersions); $templateFile = './modules/settings/SystemInformation.tpl'; break; default: $templateFile = './modules/settings/Administration.tpl'; break; } } else { $templateFile = './modules/settings/Administration.tpl'; /* Load extra settings. */ $extraSettings = array(); $modules = ModuleUtility::getModules(); foreach ($modules as $moduleName => $parameters) { $extraSettingsModule = $parameters[MODULE_SETTINGS_ENTRIES]; if ($extraSettingsModule != false) { foreach ($extraSettingsModule as $extraSettingsModuleData) { if ($extraSettingsModuleData[2] <= $this->_realAccessLevel) { $extraSettings[] = $extraSettingsModuleData; } } } } $this->_template->assign('extraSettings', $extraSettings); } if (!strcmp($templateFile, './modules/settings/Administration.tpl')) { // Highlight certain rows of importance based on criteria $candidates = new Candidates($this->_siteID); $this->_template->assign('totalCandidates', $candidates->getCount()); } if (!eval(Hooks::get('SETTINGS_DISPLAY_ADMINISTRATION'))) { return; } /* Check if careers website is enabled or can be enabled */ $careerPortalUnlock = false; $careerPortalSettings = new CareerPortalSettings($this->_siteID); $cpData = $careerPortalSettings->getAll(); if (intval($cpData['enabled']) || file_exists('modules/asp') && !$_SESSION['CATS']->isFree() || LicenseUtility::isProfessional()) { $careerPortalUnlock = true; } $this->_template->assign('careerPortalUnlock', $careerPortalUnlock); $this->_template->assign('subActive', 'Administration'); $this->_template->assign('systemAdministration', $systemAdministration); $this->_template->assign('active', $this); $this->_template->display($templateFile); }
private function loadTheme($_AUIEO_ARR_THEME_VAR) { if($_SERVER["REQUEST_URI"]=="/demo/careers/") { $AUIEO_THEME_MODULE="careers"; } else if(isset($_REQUEST["m"]) && $_REQUEST["m"]=="careers") { $AUIEO_THEME_MODULE="careers"; } else if(!$_SESSION['CATS']->isLoggedIn()) { $AUIEO_THEME_MODULE="login"; } else { $AUIEO_THEME_MODULE=isset($_REQUEST["m"])?$_REQUEST["m"]:"index"; } $objModule=new ClsAuieoModule($AUIEO_THEME_MODULE,isset($_REQUEST["a"])?$_REQUEST["a"]:"create"); $actionTheme=$objModule->getConfigVar("actions"); if($actionTheme) { $AUIEO_THEME_MODULE=$actionTheme; } if(!file_exists("themes/default/{$AUIEO_THEME_MODULE}.php")) { $AUIEO_THEME_MODULE="index"; } extract($_AUIEO_ARR_THEME_VAR); unset($_AUIEO_ARR_THEME_VAR); $HTML_ENCODING=HTML_ENCODING; $AUIEO_USER_NAME = $_SESSION['CATS']->getUsername(); $AUIEO_SITE_NAME = $_SESSION['CATS']->getSiteName(); $AUIEO_FULL_NAME = $_SESSION['CATS']->getFullName(); $AUIEO_INDEX_NAME = CATSUtility::getIndexName(); $_AUIEO_MODULE=isset($_GET["m"])?$_GET["m"]:"home"; if (strpos($AUIEO_USER_NAME, '@'.$_SESSION['CATS']->getSiteID()) !== false && substr($AUIEO_USER_NAME, strpos($username, '@'.$_SESSION['CATS']->getSiteID())) == '@'.$_SESSION['CATS']->getSiteID() ) { $AUIEO_USER_NAME = str_replace('@'.$_SESSION['CATS']->getSiteID(), '', $AUIEO_USER_NAME); } $ACCESS_LEVEL_SA_GREATER=""; if ($_SESSION['CATS']->getAccessLevel() >= ACCESS_LEVEL_SA) { $ACCESS_LEVEL_SA_GREATER = " <span style='font-weight:bold;'>Administrator</span>\n"; } $AUIEO_NOTICE=""; /* Disabled notice */ if (!$_SESSION['CATS']->accountActive()) { $AUIEO_NOTICE = "<span style='font-weight:bold;'>Account Inactive</span><br />\n"; } else if ($_SESSION['CATS']->getAccessLevel() == ACCESS_LEVEL_READ) { $AUIEO_NOTICE = "<span>Read Only Access</span><br />\n"; } ob_start(); $forceHighlight = ''; $modules = ModuleUtility::getModules(); if($_SESSION["CATS"]->getSiteID()>0) { $objPRGManagement=PRGManagement::getInstance(); } foreach ($modules as $moduleName => $parameters) { if($_SESSION["CATS"]->getSiteID()>0) { $permit=$objPRGManagement->isModulePermitted($moduleName); if($permit===false) { continue; } } $tabText = $parameters[1]; /* Don't display a module's tab if $tabText is empty. */ if (empty($tabText)) { continue; } /* If name = Companies and HR mode is on, change tab name to My Company. */ if ($_SESSION['CATS']->isHrMode() && $tabText == 'Companies') { $tabText = 'My Company'; } /* Allow a hook to prevent a module from being displayed. */ $displayTab = true; if (!eval(Hooks::get('TEMPLATE_UTILITY_EVALUATE_TAB_VISIBLE'))) return; if (!$displayTab) { continue; } /* Inactive Tab? */ if (!isset($this->active) || empty($this->active) || $moduleName != $this->active->getModuleName()) { if ($moduleName == $forceHighlight) { $className = 'active'; } else { $className = 'inactive'; } $alPosition = strpos($tabText, "*al="); if ($alPosition === false) { echo '<li><a class="', $className, '" href="', $AUIEO_INDEX_NAME, '?m=', $moduleName, '">', $tabText, '</a></li>', "\n"; } else { $al = substr($tabText, $alPosition + 4); if ($_SESSION['CATS']->getAccessLevel() >= $al || $_SESSION['CATS']->isDemo()) { echo '<li><a class="', $className, '" href="', $indexName, '?m=', $moduleName, '">', substr($tabText, 0, $alPosition), '</a></li>', "\n"; } } continue; } $alPosition = strpos($tabText, "*al="); if ($alPosition !== false) { $tabText = substr($tabText, 0, $alPosition); } /* Start the <li> block for the active tab. The secondary <ul> * for subtabs MUST be contained within this block. It is * closed after subtabs are printed. */ echo '<li>'; echo '<a class="active" href="', $AUIEO_INDEX_NAME, '?m=', $moduleName, '">', $tabText, '</a>', "\n"; $subTabs = $this->active->getSubTabs($modules); if ($subTabs) { echo '<ul id="secondary">'; foreach ($subTabs as $subTabText => $link) { if (isset($this->subActive) && $subTabText == $this->subActive) { $style = "color:#cccccc;"; } else { $style = ""; } /* Check HR mode for displaying tab. */ $hrmodePosition = strpos($link, "*hrmode="); if ($hrmodePosition !== false) { /* Access level restricted subtab. */ $hrmode = substr($link, $hrmodePosition + 8); if ((!$_SESSION['CATS']->isHrMode() && $hrmode == 0) || ($_SESSION['CATS']->isHrMode() && $hrmode == 1)) { $link = substr($link, 0, $hrmodePosition); } else { $link = ''; } } /* Check access level for displaying tab. */ $alPosition = strpos($link, "*al="); if ($alPosition !== false) { /* Access level restricted subtab. */ $al = substr($link, $alPosition + 4); if ($_SESSION['CATS']->getAccessLevel() >= $al || $_SESSION['CATS']->isDemo()) { $link = substr($link, 0, $alPosition); } else { $link = ''; } } $jsPosition = strpos($link, "*js="); if ($jsPosition !== false) { /* Javascript subtab. */ echo '<li><a href="', substr($link, 0, $jsPosition), '" onclick="', substr($link, $jsPosition + 4), '" style="'.$style.'">', $subTabText, '</a></li>', "\n"; } /* A few subtabs have special logic to decide if they display or not. */ /* FIXME: Put the logic for these somewhere else. Perhaps the definitions of the subtabs themselves should have an eval()uatable rule? Brian 6-14-07: Second. */ else if (strpos($link, 'a=internalPostings') !== false) { /* Default company subtab. */ include_once('./lib/Companies.php'); $companies = new Companies($_SESSION['CATS']->getSiteID()); $defaultCompanyID = $companies->getDefaultCompany(); if ($defaultCompanyID !== false) { echo '<li><a href="', $link, '" style="'.$style.'">', $subTabText, '</a></li>', "\n"; } } else if (strpos($link, 'a=administration') !== false) { /* Administration subtab. */ if ($_SESSION['CATS']->getRealAccessLevel() >= ACCESS_LEVEL_DEMO) { echo '<li><a href="', $link, '" style="'.$style.'">', $subTabText, '</a></li>', "\n"; } } else if (strpos($link, 'a=customizeEEOReport') !== false) { /* EEO Report subtab. Shouldn't be visible if EEO tracking is disabled. */ $EEOSettings = new EEOSettings($_SESSION['CATS']->getSiteID()); $EEOSettingsRS = $EEOSettings->getAll(); if ($EEOSettingsRS['enabled'] == 1) { echo '<li><a href="', $link, '" style="'.$style.'">', $subTabText, '</a></li>', "\n"; } } /* Tab is ok to draw. */ else if ($link != '') { /* Normal subtab. */ echo '<li><a href="', $link, '" style="'.$style.'">', $subTabText, '</a></li>', "\n"; } } if (!eval(Hooks::get('TEMPLATE_UTILITY_DRAW_SUBTABS'))) return; echo '</ul>'; } echo '</li>'; } $_AUIEO_TABS= ob_get_clean(); $systemInfo = new SystemInfo(); $systemInfoData = $systemInfo->getSystemInfo(); $AUIEO_DOWNLOAD_LATEST=""; if (isset($systemInfoData['available_version']) && $systemInfoData['available_version'] > CATSUtility::getVersionAsInteger() && isset($systemInfoData['disable_version_check']) && !$systemInfoData['disable_version_check'] && $_SESSION['CATS']->getAccessLevel() >= ACCESS_LEVEL_SA) { $AUIEO_DOWNLOAD_LATEST = "<a href='http://www.catsone.com/download.php' target='catsdl'>A new CATS version is available!</a><br />"; } $AUIEO_RECENT=""; if (!empty($MRU)) { $AUIEO_RECENT = '<span class="MRUTitle">Recent: </span> {$MRU}'; } else { $AUIEO_RECENT = '<span class="MRUTitle"></span> '; } $AUIEO_HAS_USER_CATEGORY=""; //FIXME: Abstract into a hook. if ($_SESSION['CATS']->hasUserCategory('msa')) { $AUIEO_HAS_USER_CATEGORY = "<input type='hidden' name='m' value='asp' /> <input type='hidden' name='a' value='aspSearch' /> <span class='quickSearchLabel' id='quickSearchLabel>ASP Search:</span> "; } else { $AUIEO_HAS_USER_CATEGORY = "<input type='hidden' name='m' value='home' /> <input type='hidden' name='a' value='quickSearch' /> <span class='quickSearchLabel' id='quickSearchLabel'>Quick Search:</span> "; } $wildCardString = ''; /* Get the formatted MRU list from Session. */ $MRU = $_SESSION['CATS']->getMRU()->getFormatted(); $indexName = CATSUtility::getIndexName(); $AUIEO_PREFIX=""; if(isset($_REQUEST["m"]) && $_REQUEST["m"]=="careers") { $AUIEO_PREFIX="../"; } $pageTitle = pageTitle(); $headIncludes = pageHeaderInclude(); $AUIEO_PAGE_START=""; ob_start(); //TemplateUtility::_printCommonHeader($pageTitle, $headIncludes); if (!is_array($headIncludes)) { $headIncludes = array($headIncludes); } $siteID = $_SESSION['CATS']->getSiteID(); /* This prevents caching problems when SVN updates are preformed. */ if ($_SESSION['CATS']->getCachedBuild() > 0) { $javascriptAntiCache = '?b=' . $_SESSION['CATS']->getCachedBuild(); } else { $javascriptAntiCache = '?v=' . CATSUtility::getVersionAsInteger(); } $headIncludes[] = 'main.css'; foreach ($headIncludes as $key => $filename) { /* Done manually to prevent a global dependency on FileUtility. */ if ($filename == 'tinymce') { echo ('<script language="javascript" type="text/javascript" src="lib/tinymce/jscripts/tiny_mce/tiny_mce.js"></script>'."\n". '<script language="javascript" type="text/javascript">tinyMCE.init({ mode : "specific_textareas", editor_selector : "mceEditor", width : "100%", theme : "advanced", theme_advanced_buttons1 : "bold,italic,strikethrough,separator,bullist,numlist,outdent,indent,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,link,unlink,separator,underline,forecolor,separator,removeformat,cleanup,separator,charmap,separator,undo,redo", theme_advanced_buttons2 : "", theme_advanced_buttons3 : "", language : "en", theme_advanced_toolbar_location : "top", theme_advanced_toolbar_align : "left", theme_advanced_resizing : true, browsers : "msie,gecko,opera,safari", dialog_type : "modal", theme_advanced_resize_horizontal : false, convert_urls : false, relative_urls : false, remove_script_host : false, force_p_newlines : false, force_br_newlines : true, convert_newlines_to_brs : false, remove_linebreaks : false, fix_list_elements : true });</script>'."\n"); } else { $extension = substr($filename, strrpos($filename, '.') + 1); $filename .= $javascriptAntiCache; if ($extension == 'js') { echo '<script type="text/javascript" src="', $filename, '"></script>', "\n"; } else if ($extension == 'css') { echo '<style type="text/css" media="all">@import "', $filename, '";</style>', "\n"; } } } $AUIEO_PAGE_START= ob_get_clean(); //ob_start(); $AUIEO_LOAD_TIME = $_SESSION['CATS']->getExecutionTime(); $AUIEO_CANDIDATS_VERSION=CANDIDATS_VERSION; include("themes/default/{$AUIEO_THEME_MODULE}.php"); /** * for handing comment in html template. usage is {$_("This is comment")} */ $_=function($comment) { return ""; }; ob_start(); eval('echo <<< EOT '.file_get_contents("themes/default/{$AUIEO_THEME_MODULE}.html").' EOT; '); $html = ob_get_clean(); return $html; }