示例#1
0
 public static function setTaskError($taskID, $errorCode = 1)
 {
     $db = DatabaseConnection::getInstance();
     $sql = sprintf("UPDATE\n                queue\n             SET\n                error = %s\n             WHERE\n                queue_id = %s", $db->makeQueryInteger($errorCode), $db->makeQueryInteger($taskID));
     $rs = $db->query($sql);
     if ($errorCode == 1) {
         if (!eval(Hooks::get('QUEUEERROR_NOTIFY_DEV'))) {
             return;
         }
     }
     return $rs;
 }
示例#2
0
 private function getAttachment()
 {
     // FIXME: Do we really need to mess with memory limits here? We're only reading ~80KB at a time...
     @ini_set('memory_limit', '128M');
     if (!$this->isRequiredIDValid('id', $_GET)) {
         CommonErrors::fatal(COMMONERROR_BADINDEX, $this, 'No attachment ID specified.');
     }
     $attachmentID = $_GET['id'];
     $attachments = new Attachments(-1);
     $rs = $attachments->get($attachmentID, false);
     if (empty($rs) || md5($rs['directoryName']) != $_GET['directoryNameHash']) {
         CommonErrors::fatal(COMMONERROR_BADFIELDS, $this, 'Invalid id / directory / filename, or you do not have permission to access this attachment.');
     }
     $directoryName = $rs['directoryName'];
     $fileName = $rs['storedFilename'];
     $filePath = sprintf('attachments/%s/%s', $directoryName, $fileName);
     /* Check for the existence of the backup.  If it is gone, send the user to a page informing them to press back and generate the backup again. */
     if ($rs['contentType'] == 'catsbackup' && !file_exists($filePath)) {
         CommonErrors::fatal(COMMONERROR_FILENOTFOUND, $this, 'The specified backup file no longer exists. Please go back and regenerate the backup before downloading. We are sorry for the inconvenience.');
     }
     // FIXME: Stream file rather than redirect? (depends on download preparer working).
     if (!eval(Hooks::get('ATTACHMENT_RETRIEVAL'))) {
         return;
     }
     /* Determine MIME content type of the file. */
     $contentType = Attachments::fileMimeType($fileName);
     /* Open the file and verify that it is readable. */
     $fp = @fopen($filePath, 'r');
     if ($fp === false) {
         CommonErrors::fatal(COMMONERROR_BADFIELDS, $this, 'This attachment is momentarily offline, please try again later. The support staff has been notified.');
     }
     /* Set headers for sending the file. */
     header('Content-Disposition: inline; filename="' . $fileName . '"');
     //Disposition attachment was default, but forces download.
     header('Content-Type: ' . $contentType);
     header('Content-Length: ' . filesize($filePath));
     header('Pragma: no-cache');
     header('Expires: 0');
     /* Read the file in ATTACHMENT_BLOCK_SIZE-sized chunks from disk and
      * output to the browser.
      */
     while (!feof($fp)) {
         print fread($fp, self::ATTACHMENT_BLOCK_SIZE);
     }
     fclose($fp);
     /* Exit to prevent output after the attachment. */
     exit;
 }
示例#3
0
 /**
  * Adds a candidate to the pipeline for a job order.
  *
  * @param integer job order ID
  * @param integer candidate ID
  * @return true on success; false otherwise.
  */
 public function add($candidateID, $jobOrderID, $userID = 0)
 {
     $sql = sprintf("SELECT\n                COUNT(candidate_id) AS candidateIDCount\n            FROM\n                candidate_joborder\n            WHERE\n                candidate_id = %s\n            AND\n                joborder_id = %s\n            AND\n                site_id = %s", $this->_db->makeQueryInteger($candidateID), $this->_db->makeQueryInteger($jobOrderID), $this->_siteID);
     $rs = $this->_db->getAssoc($sql);
     if (empty($rs)) {
         return false;
     }
     $count = $rs['candidateIDCount'];
     if ($count > 0) {
         /* Candidate already exists in the pipeline. */
         return false;
     }
     $extraFields = '';
     $extraValues = '';
     if (!eval(Hooks::get('PIPELINES_ADD_SQL'))) {
         return;
     }
     $sql = sprintf("INSERT INTO candidate_joborder (\n                site_id,\n                joborder_id,\n                candidate_id,\n                status,\n                added_by,\n                date_created,\n                date_modified%s\n            )\n            VALUES (\n                %s,\n                %s,\n                %s,\n                100,\n                %s,\n                NOW(),\n                NOW()%s\n            )", $extraFields, $this->_siteID, $this->_db->makeQueryInteger($jobOrderID), $this->_db->makeQueryInteger($candidateID), $this->_db->makeQueryInteger($userID), $extraValues);
     $queryResult = $this->_db->query($sql);
     if (!$queryResult) {
         return false;
     }
     return true;
 }
示例#4
0
 private function displayPublicJobOrders()
 {
     $site = new Site(-1);
     $careerPortalSiteID = $site->getFirstSiteID();
     if (!eval(Hooks::get('RSS_SITEID'))) {
         return;
     }
     $jobOrders = new JobOrders($careerPortalSiteID);
     $rs = $jobOrders->getAll(JOBORDERS_STATUS_ACTIVE, -1, -1, -1, false, true);
     /* XML Headers */
     header('Content-type: text/xml');
     $indexName = CATSUtility::getIndexName();
     $stream = sprintf("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" . "<rss version=\"2.0\">\n" . "<channel>\n" . "<title>New Job Orders</title>\n" . "<description>CATS RSS Feed</description>\n" . "<link>%s</link>\n" . "<pubDate>%s</pubDate>\n", CATSUtility::getAbsoluteURI(), DateUtility::getRSSDate());
     foreach ($rs as $rowIndex => $row) {
         $uri = sprintf("%scareers/?p=showJob&amp;ID=%d", CATSUtility::getAbsoluteURI(), $row['jobOrderID']);
         // Fix URL if viewing from /rss without using globals or dirup '../'
         if (strpos($_SERVER['PHP_SELF'], '/rss/') !== false) {
             $uri = str_replace('/rss/', '/', $uri);
         }
         $stream .= sprintf("<item>\n" . "<title>%s (%s)</title>\n" . "<description>Located in %s.</description>\n" . "<link>%s</link>\n" . "</item>\n", $row['title'], $jobOrders->typeCodeToString($row['type']), StringUtility::makeCityStateString($row['city'], $row['state']), $uri);
     }
     $stream .= "</channel>\n</rss>\n";
     echo $stream;
 }
示例#5
0
 public function wizard_website()
 {
     if (!isset($_SESSION['CATS']) || empty($_SESSION['CATS'])) {
         echo 'CATS has lost your session!';
         return;
     }
     $website = trim(isset($_GET[$id = 'website']) ? $_GET[$id] : '');
     if (strlen($website) > 10) {
         if (!eval(Hooks::get('SETTINGS_CP_REQUEST'))) {
             return;
         }
     }
     echo 'Ok';
 }
示例#6
0
 /**
  * Prints footer HTML for non-report pages.
  *
  * @return void
  */
 public static function printFooter()
 {
     $build = $_SESSION['CATS']->getCachedBuild();
     $loadTime = $_SESSION['CATS']->getExecutionTime();
     if ($build > 0) {
         $buildString = ' build ' . $build;
     } else {
         $buildString = '';
     }
     /* THE MODIFICATION OF THE COPYRIGHT AND 'Powered by CATS' LINES IS NOT ALLOWED
                BY THE TERMS OF THE CPL FOR CATS OPEN SOURCE EDITION.
     
                  II) The following copyright notice must be retained and clearly legible
                  at the bottom of every rendered HTML document: Copyright (C) 2005 - 2007
                  Cognizo Technologies, Inc. All rights reserved.
     
                  III) The "Powered by CATS" text or logo must be retained and clearly
                  legible on every rendered HTML document. The logo, or the text
                  "CATS", must be a hyperlink to the CATS Project website, currently
                  http://www.catsone.com/.
            */
     echo '<div class="footerBlock">', "\n";
     echo '<p id="footerText">CATS Version ', CATS_VERSION, $buildString, '. <span id="toolbarVersion"></span>Powered by <a href="http://www.catsone.com/"><strong>CATS</strong></a>.</p>', "\n";
     echo '<span id="footerResponse">Server Response Time: ', $loadTime, ' seconds.</span><br />';
     echo '<span id="footerCopyright">', COPYRIGHT_HTML, '</span>', "\n";
     if (!eval(Hooks::get('TEMPLATEUTILITY_SHOWPRIVACYPOLICY'))) {
         return;
     }
     echo '</div>', "\n";
     eval(Hooks::get('TEMPLATE_UTILITY_PRINT_FOOTER'));
     echo '</body>', "\n";
     echo '</html>', "\n";
     if ((!file_exists('modules/asp') || defined('CATS_TEST_MODE') && CATS_TEST_MODE) && LicenseUtility::isProfessional() && !rand(0, 10)) {
         if (!LicenseUtility::validateProfessionalKey(LICENSE_KEY)) {
             CATSUtility::changeConfigSetting('LICENSE_KEY', "''");
         }
     }
 }
                echo $delimiter, 'asc', $delimiter;
            } else {
                echo $delimiter, 'desc', $delimiter;
            }
        } else {
            echo $delimiter, 'asc', $delimiter;
        }
    } else {
        if ($sortDirection == 'desc' || $sortDirection == '') {
            echo $delimiter, 'desc', $delimiter;
        } else {
            echo $delimiter, 'asc', $delimiter;
        }
    }
}
if (!eval(Hooks::get('JO_AJAX_GET_PIPELINE'))) {
    return;
}
?>

<?php 
echo TemplateUtility::getRatingsArrayJS();
?>

<script type="text/javascript">
    PipelineJobOrder_setLimitDefaultVars('<?php 
echo $sortBy;
?>
', '<?php 
echo $sortDirection;
?>
示例#8
0
<?php 
//trace("======");
/* 
 * CandidATS
 * Sites Management
 *
 * Copyright (C) 2014 - 2015 Auieo Software Private Limited, Parent Company of Unicomtech.
 * 
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

ob_start();
if ($this->isPopup)
{
    TemplateUtility::printHeader('Candidate - '.$this->data['first_name'].' '.$this->data['last_name'], array( 'js/activity.js', 'js/sorttable.js', 'js/match.js', 'js/lib.js', 'js/pipeline.js', 'js/attachment.js'));
}
else
{
    TemplateUtility::printHeader('Candidate - '.$this->data['first_name'].' '.$this->data['last_name'], array( 'js/activity.js', 'js/sorttable.js', 'js/match.js', 'js/lib.js', 'js/pipeline.js', 'js/attachment.js'));
}
$AUIEO_HEADER=  ob_get_clean();

$AUIEO_CONTENT="";
ob_start();
if ($this->data['is_admin_hidden'] == 1)
{
    ?>
    <p class="warning">This Candidate is hidden.  Only CATS Administrators can view it or search for it.  To make it visible by the site users, click <a href="<?php echo(CATSUtility::getIndexName()); ?>?m=candidates&a=administrativeHideShow&candidateID=<?php echo($this->candidateID); ?>&state=0" style="font-weight:bold;">Here.</a></p>
<?php 
示例#9
0
 /**
  * Submits all applicable job feeds in all available formats to the
  * asynchronous queue processor which begins submitting them to the
  * appropriate websites.
  *
  * @param int ID of the site to submit
  */
 public static function submitXMLFeeds($siteID)
 {
     if (!eval(Hooks::get('XML_SUBMIT_FEEDS_TO_QUEUE'))) {
         return;
     }
 }
示例#10
0
 private function onDeleteAttachment()
 {
     if ($this->_accessLevel < ACCESS_LEVEL_DELETE) {
         $this->listByView('Invalid user level for action.');
         return;
     }
     /* Bail out if we don't have a valid attachment ID. */
     if (!$this->isRequiredIDValid('attachmentID', $_GET)) {
         CommonErrors::fatalModal(COMMONERROR_BADINDEX, $this, 'Invalid attachment ID.');
     }
     /* Bail out if we don't have a valid joborder ID. */
     if (!$this->isRequiredIDValid('companyID', $_GET)) {
         CommonErrors::fatalModal(COMMONERROR_BADINDEX, $this, 'Invalid company ID.');
     }
     $companyID = $_GET['companyID'];
     $attachmentID = $_GET['attachmentID'];
     if (!eval(Hooks::get('CLIENTS_ON_DELETE_ATTACHMENT_PRE'))) {
         return;
     }
     $attachments = new Attachments($this->_siteID);
     $attachments->delete($attachmentID);
     if (!eval(Hooks::get('CLIENTS_ON_DELETE_ATTACHMENT_POST'))) {
         return;
     }
     CATSUtility::transferRelativeURI('m=companies&a=show&companyID=' . $companyID);
 }
示例#11
0
    public function generateJobOrderReportPDF()
    {
        /* E_STRICT doesn't like FPDF. */
        $errorReporting = error_reporting();
        error_reporting($errorReporting & ~ E_STRICT);
        include_once('./lib/fpdf/fpdf.php');
        error_reporting($errorReporting);

        // FIXME: Hook?
        $isASP = $_SESSION['CATS']->isASP();

        $unixName = $_SESSION['CATS']->getUnixName();

        $siteName       = $this->getTrimmedInput('siteName', $_GET);
        $companyName    = $this->getTrimmedInput('companyName', $_GET);
        $jobOrderName   = $this->getTrimmedInput('jobOrderName', $_GET);
        $periodLine     = $this->getTrimmedInput('periodLine', $_GET);
        $accountManager = $this->getTrimmedInput('accountManager', $_GET);
        $recruiter      = $this->getTrimmedInput('recruiter', $_GET);
        $notes          = $this->getTrimmedInput('notes', $_GET);

        if (isset($_GET['dataSet']))
        {
            $dataSet = $_GET['dataSet'];
            $dataSet = explode(',', $dataSet);
        }
        else
        {
            $dataSet = array(4, 3, 2, 1);
        }


        /* PDF Font Face. */
        // FIXME: Customizable.
        $fontFace = 'helvetica';
        $pdf=new \TCPDF();
        //$pdf = new FPDF();
        $pdf->AddPage();

        if (!eval(Hooks::get('REPORTS_CUSTOMIZE_JO_REPORT_PRE'))) return;
        $pdf->SetFont($fontFace, 'B', 10);
        if ($isASP && $unixName == 'cognizo')
        {
            /* TODO: MAKE THIS CUSTOMIZABLE FOR EVERYONE. */
            
            $pdf->Image('images/cognizo-logo.jpg', 130, 10, 59, 20);
            $pdf->SetXY(129,27);
            $pdf->Write(5, 'Information Technology Consulting');
        }

        $pdf->SetXY(25, 35);
        $pdf->SetFont($fontFace, 'BU', 14);
        $pdf->Write(5, "Recruiting Summary Report\n");

        $pdf->SetFont($fontFace, '', 10);
        $pdf->SetX(25);
        $pdf->Write(5, DateUtility::getAdjustedDate('l, F d, Y') . "\n\n\n");

        $pdf->SetFont($fontFace, 'B', 10);
        $pdf->SetX(25);
        $pdf->Write(5, 'Company: '. $companyName . "\n");

        $pdf->SetFont($fontFace, '', 10);
        $pdf->SetX(25);
        $pdf->Write(5, 'Position: ' . $jobOrderName . "\n\n");

        $pdf->SetFont($fontFace, '', 10);
        $pdf->SetX(25);
        $pdf->Write(5, 'Period: ' . $periodLine . "\n\n");

        $pdf->SetFont($fontFace, '', 10);
        $pdf->SetX(25);
        $pdf->Write(5, 'Account Manager: ' . $accountManager . "\n");

        $pdf->SetFont($fontFace, '', 10);
        $pdf->SetX(25);
        $pdf->Write(5, 'Recruiter: ' . $recruiter . "\n");

        /* Note that the server is not logged in when getting this file from
         * itself.
         */
        // FIXME: Pass session cookie in URL? Use cURL and send a cookie? I
        //        really don't like this... There has to be a way.
        // FIXME: "could not make seekable" - http://demo.catsone.net/index.php?m=graphs&a=jobOrderReportGraph&data=%2C%2C%2C
        //        in /usr/local/www/catsone.net/data/lib/fpdf/fpdf.php on line 1500
        $URI = CATSUtility::getAbsoluteURI(
            CATSUtility::getIndexName()
            . '?m=graphs&a=jobOrderReportGraph&data='
            . urlencode(implode(',', $dataSet))
        );

        $pdf->Image($URI, 70, 95, 80, 80, 'jpg');

        $pdf->SetXY(25,180);
        $pdf->SetFont($fontFace, '', 10);
        $pdf->Write(5, 'Total Candidates ');
        $pdf->SetTextColor(255, 0, 0);
        $pdf->Write(5, 'Screened');
        $pdf->SetTextColor(0, 0, 0);
        $pdf->Write(5, ' by ' . $siteName . ": \n\n");

        $pdf->SetX(25);
        $pdf->SetFont($fontFace, '', 10);
        $pdf->Write(5, 'Total Candidates ');
        $pdf->SetTextColor(0, 125, 0);
        $pdf->Write(5, 'Submitted');
        $pdf->SetTextColor(0, 0, 0);
        $pdf->Write(5, ' to ' . $companyName . ": \n\n");

        $pdf->SetX(25);
        $pdf->SetFont($fontFace, '', 10);
        $pdf->Write(5, 'Total Candidates ');
        $pdf->SetTextColor(0, 0, 255);
        $pdf->Write(5, 'Interviewed');
        $pdf->SetTextColor(0, 0, 0);
        $pdf->Write(5, ' by ' . $companyName . ": \n\n");

        $pdf->SetX(25);
        $pdf->SetFont($fontFace, '', 10);
        $pdf->Write(5, 'Total Candidates ');
        $pdf->SetTextColor(255, 75, 0);
        $pdf->Write(5, 'Placed');
        $pdf->SetTextColor(0, 0, 0);
        $pdf->Write(5, ' at ' . $companyName . ": \n\n\n");

        if ($notes != '')
        {
            $pdf->SetX(25);
            $pdf->SetFont($fontFace, '', 10);
            $pdf->Write(5, "Notes:\n");

            $len = strlen($notes);
            $maxChars = 70;

            $pdf->SetLeftMargin(25);
            $pdf->SetRightMargin(25);
            $pdf->SetX(25);
            $pdf->Write(5, $notes . "\n");
        }

        $pdf->SetXY(165, 180);
        $pdf->SetFont($fontFace, 'B', 10);
        $pdf->Write(5, $dataSet[0] . "\n\n");
        $pdf->SetX(165);
        $pdf->Write(5, $dataSet[1] . "\n\n");
        $pdf->SetX(165);
        $pdf->Write(5, $dataSet[2] . "\n\n");
        $pdf->SetX(165);
        $pdf->Write(5, $dataSet[3] . "\n\n");

        $pdf->Rect(3, 6, 204, 285);

        if (!eval(Hooks::get('REPORTS_CUSTOMIZE_JO_REPORT_POST'))) return;

        $pdf->Output();
        die();
    }
示例#12
0
 /**
  * Forces the session to make the current user "transparently" login to
  * another site. This is used only to support the CATS administrative
  * console, but must remain part of Session.
  *
  * @param integer New Site ID to login to.
  * @param integer User ID with which to login to the new site.
  * @param integer Site ID associated with $asUserID
  * @return void
  */
 public function transparentLogin($toSiteID, $asUserID, $asSiteID)
 {
     $db = DatabaseConnection::getInstance();
     $sql = sprintf("SELECT\n                user.user_id AS userID,\n                user.user_name AS username,\n                user.first_name AS firstName,\n                user.last_name AS lastName,\n                user.access_level AS accessLevel,\n                user.site_id AS userSiteID,\n                user.is_demo AS isDemoUser,\n                user.email AS email,\n                user.categories AS categories,\n                site.name AS siteName,\n                site.unix_name AS unixName,\n                site.company_id AS companyID,\n                site.is_demo AS isDemo,\n                site.account_active AS accountActive,\n                site.account_deleted AS accountDeleted,\n                site.time_zone AS timeZone,\n                site.date_format_ddmmyy AS dateFormatDMY,\n                site.is_free AS isFree,\n                site.is_hr_mode AS isHrMode\n            FROM\n                user\n            LEFT JOIN site\n                ON site.site_id = %s\n            WHERE\n                user.user_id = %s\n                AND user.site_id = %s", $toSiteID, $asUserID, $asSiteID);
     $rs = $db->getAssoc($sql);
     $this->_username = $rs['username'];
     $this->_userID = $rs['userID'];
     $this->_siteID = $toSiteID;
     $this->_firstName = $rs['firstName'];
     $this->_lastName = $rs['lastName'];
     $this->_siteName = $rs['siteName'];
     $this->_unixName = $rs['unixName'];
     $this->_accessLevel = $rs['accessLevel'];
     $this->_realAccessLevel = $rs['accessLevel'];
     $this->_categories = array();
     $this->_isASP = $rs['companyID'] != 0 ? true : false;
     $this->_siteCompanyID = $rs['companyID'] != 0 ? $rs['companyID'] : -1;
     $this->_isFree = $rs['isFree'] == 0 ? false : true;
     $this->_isHrMode = $rs['isHrMode'] != 0 ? true : false;
     $this->_accountActive = $rs['accountActive'] == 0 ? false : true;
     $this->_accountDeleted = $rs['accountDeleted'] == 0 ? false : true;
     $this->_email = $rs['email'];
     $this->_timeZone = $rs['timeZone'];
     $this->_dateDMY = $rs['dateFormatDMY'] == 0 ? false : true;
     $this->_isFirstTimeSetup = true;
     $this->_isAgreedToLicense = true;
     $this->_isLocalizationConfigured = true;
     /* Mark session as logged in. */
     $this->_isLoggedIn = true;
     /* Force a new MRU object to be created. */
     $this->_MRU = null;
     if (!eval(Hooks::get('TRANSPARENT_LOGIN_POST'))) {
         return;
     }
     $cookie = $this->getCookie();
     $sql = sprintf("UPDATE\n                user\n             SET\n                session_cookie = %s\n             WHERE\n                user_id = %s\n             AND\n                site_id = %s", $db->makeQueryString($cookie), $asUserID, $asSiteID);
     $db->query($sql);
 }
示例#13
0
 public function __construct($siteID, $parameters, $misc)
 {
     /* Pager configuration. */
     $this->_tableWidth = 915;
     $this->_defaultAlphabeticalSortBy = 'title';
     $this->ajaxMode = false;
     $this->showExportCheckboxes = true;
     //BOXES WILL NOT APPEAR UNLESS SQL ROW exportID IS RETURNED!
     $this->showActionArea = true;
     $this->showChooseColumnsBox = true;
     $this->allowResizing = true;
     $this->defaultSortBy = 'dateCreatedSort';
     $this->defaultSortDirection = 'DESC';
     $this->_defaultColumns = array(array('name' => 'Attachments', 'width' => 10), array('name' => 'ID', 'width' => 26), array('name' => 'Title', 'width' => 170), array('name' => 'Company', 'width' => 135), array('name' => 'Type', 'width' => 30), array('name' => 'Status', 'width' => 40), array('name' => 'Created', 'width' => 55), array('name' => 'Age', 'width' => 30), array('name' => 'Submitted', 'width' => 18), array('name' => 'Pipeline', 'width' => 18), array('name' => 'Recruiter', 'width' => 65), array('name' => 'Owner', 'width' => 55));
     if (!eval(Hooks::get('JOBORDERS_DATAGRID_DEFAULTS'))) {
         return;
     }
     parent::__construct("joborders:joborderSavedListByViewDataGrid", $siteID, $parameters, $misc);
 }
示例#14
0
 private function newSubmissions()
 {
     /* Grab an instance of Statistics. */
     $statistics = new Statistics($this->_siteID);
     $RS = $statistics->getSubmissionsByPeriod(TIME_PERIOD_LASTTWOWEEKS);
     // FIXME: Factor out these calculations? Common to most of these graphs.
     $firstDay = mktime(0, 0, 0, DateUtility::getAdjustedDate('m'), DateUtility::getAdjustedDate('d') - DateUtility::getAdjustedDate('w') - 7, DateUtility::getAdjustedDate('Y'));
     $y = array();
     for ($i = 0; $i < 14; $i++) {
         $thisDay = mktime(0, 0, 0, date('m', $firstDay), date('d', $firstDay) + $i, date('Y', $firstDay));
         $y[] = date('d', $thisDay);
     }
     /* Get values. */
     $x = array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
     foreach ($RS as $lineRS) {
         $thisDay = mktime(0, 0, 0, $lineRS['month'], $lineRS['day'], $lineRS['year']);
         $dayOfWeek = (int) date('w', $thisDay);
         if (DateUtility::getWeekNumber($thisDay) != DateUtility::getWeekNumber()) {
             $x[$dayOfWeek]++;
         } else {
             $x[$dayOfWeek + 7]++;
         }
     }
     $graph = new GraphSimple($y, $x, 'Orange', 'New Submissions', $this->width, $this->height);
     if (!eval(Hooks::get('GRAPH_NEW_SUBMISSIONS'))) {
         return;
     }
     $graph->draw();
     die;
 }
示例#15
0
    /**
     * Sets up export options and exports items
     *
     * @return void
     */
    public function onExport()
    {
        $filename = 'export.csv';

        /* Bail out if we don't have a valid data item type. */
        if (!$this->isRequiredIDValid('dataItemType', $_GET))
        {
            CommonErrors::fatal(COMMONERROR_BADFIELDS, $this, 'Invalid data item type.');
        }

        $dataItemType = $_GET['dataItemType'];

        /* Are we in "Only Selected" mode? */
        if ($this->isChecked('onlySelected', $_GET))
        {
            foreach ($_GET as $key => $value)
            {
                if (!strstr($key, 'checked_'))
                {
                    continue;
                }

                $IDs[] = str_replace('checked_', '', $key);
            }
        }
        else
        {
            /* No; do we have a list of IDs to export (Page Mode)? */
            $tempIDs = $this->getTrimmedInput('ids', $_GET);
            if (!empty($tempIDs))
            {
                $IDs = explode(',', $tempIDs);
            }
            else
            {
                /* No; All Records Mode. */
                $IDs = array();
            }
        }

        $export = new Export($dataItemType, $IDs, ',', $this->_siteID);
        $output = $export->getFormattedOutput();

        if (!eval(Hooks::get('EXPORT'))) return;

        header('Content-Disposition: attachment; filename="' . $filename . '"');
        header('Content-Length: ' . strlen($output));
        header('Connection: close');
        header('Content-Type: text/x-csv; name=' . $filename);
        echo $output;exit;
    }
示例#16
0
                'Adding attachments (%s of %s files processed)...',
                $attachmentCount,
                $totalAttachments
            ),
            ($attachmentCount / $totalAttachments)
        );

        $relativePath = sprintf(
            'attachments/%s/%s',
            $row['directory_name'],
            $row['stored_filename']
        );
        
        $attachmentID = $row['attachment_id'];
        
        if (!eval(Hooks::get('FORCE_ATTACHMENT_LOCAL'))) return;
        
        $status = $zipFileCreator->addFileFromDisk(
            $relativePath, $relativePath
        );
    }
    markCompleted('Adding attachments...');

    /* Finalize the zip file and write it to disk. */
    setStatusBackup('Writing backup...', 1);
    $status = $zipFileCreator->finalize();
    if (!$status)
    {
        setStatusBackup('Error: Failed to write zip file.', 0);
        die('Failed to add write zip file.');
    }
示例#17
0
 /**
  * Preforms some basic find/replace rules on template text and returns the
  * resulting string.
  *
  * @param string template text
  * @return string modified template text
  */
 public function replaceVariables($text)
 {
     $email = $_SESSION['CATS']->getEmail();
     $siteName = $_SESSION['CATS']->getSiteName();
     $fullName = $_SESSION['CATS']->getFullName();
     if ($_SESSION['CATS']->isDateDMY()) {
         $dateFormat = 'd-m-y';
     } else {
         $dateFormat = 'm-d-y';
     }
     if (isset($_SESSION['CATS'])) {
         $isLoggedIn = $_SESSION['CATS']->isLoggedIn();
     } else {
         $isLoggedIn = false;
     }
     /* Variables to be replaced. */
     $stringsToFind = array('%DATETIME%', '%SITENAME%', '%USERFULLNAME%', '%USERMAIL%');
     if ($isLoggedIn) {
         $replacementStrings = array(DateUtility::getAdjustedDate($dateFormat . ' g:i A'), $siteName, $fullName, '<a href="mailto:' . $email . '">' . $email . '</a>');
     } else {
         $site = new Site(-1);
         $siteID = $site->getFirstSiteID();
         if (!eval(Hooks::get('CAREERS_SITEID'))) {
             return;
         }
         $siteRS = $site->getSiteBySiteID($siteID);
         if (!isset($siteRS['name'])) {
             die('An error has occurred: No site exists with this site name.');
         }
         $siteName = $siteRS['name'];
         $replacementStrings = array(DateUtility::getAdjustedDate($dateFormat . ' g:i A'), $siteName, '', '<a href="mailto:' . $email . '">' . $email . '</a>');
     }
     return str_replace($stringsToFind, $replacementStrings, $text);
 }
示例#18
0
 private function displayPublicJobOrders()
 {
     $site = new Site(-1);
     $careerPortalSiteID = $site->getFirstSiteID();
     if (!eval(Hooks::get('RSS_SITEID'))) {
         return;
     }
     $jobOrders = new JobOrders($careerPortalSiteID);
     $rs = $jobOrders->getAll(JOBORDERS_STATUS_ACTIVE, -1, -1, -1, false, true);
     // Log that this file was accessed
     // FIXME: Does this really need to involve two queries? Can we store
     //        the IDs in constants too?
     HTTPLogger::addHTTPLog(HTTPLogger::getHTTPLogTypeIDByName('xml'), $careerPortalSiteID);
     /* XML Headers */
     header('Content-type: text/xml');
     $indexName = CATSUtility::getIndexName();
     $availTemplates = XmlTemplate::getTemplates();
     if (isset($_GET['t'])) {
         $templateName = $_GET['t'];
         // Check if the template exists
         foreach ($availTemplates as $template) {
             if (!strcasecmp($template['xml_template_name'], $templateName)) {
                 $templateSections = XmlTemplate::loadTemplate($templateName);
             }
         }
     }
     // no template exists, load the default (which will always be first)
     if (!isset($templateSections)) {
         $templateSections = XmlTemplate::loadTemplate($templateName = $availTemplates[0]["xml_template_name"]);
     }
     // get the section bodies from the template into strings
     $templateHeader = $templateSections[XTPL_HEADER_STRING];
     $templateJob = $templateSections[XTPL_JOB_STRING];
     $templateFooter = $templateSections[XTPL_FOOTER_STRING];
     $tags = XmlTemplate::loadTemplateTags($templateHeader);
     foreach ($tags as $tag) {
         switch ($tag) {
             case 'date':
                 $templateHeader = XmlTemplate::replaceTemplateTags($tag, DateUtility::getRSSDate(), $templateHeader);
                 break;
             case 'siteURL':
                 $templateHeader = XmlTemplate::replaceTemplateTags($tag, CATSUtility::getAbsoluteURI(''), $templateHeader);
                 break;
         }
     }
     $stream = $templateHeader;
     $tags = XmlTemplate::loadTemplateTags($templateJob);
     $careerPortalSettings = new CareerPortalSettings($careerPortalSiteID);
     $settings = $careerPortalSettings->getAll();
     if ($settings['allowBrowse'] == 1) {
         // browse the jobs, adding a section body for each job
         foreach ($rs as $rowIndex => $row) {
             $txtJobPosting = $templateJob;
             foreach ($tags as $tag) {
                 switch ($tag) {
                     case 'siteURL':
                         $txtJobPosting = XmlTemplate::replaceTemplateTags($tag, substr(CATSUtility::getAbsoluteURI(''), 0, -4), $txtJobPosting);
                         break;
                     case 'jobTitle':
                         $txtJobPosting = XmlTemplate::replaceTemplateTags($tag, $row['title'], $txtJobPosting);
                         break;
                     case 'jobPostDate':
                         $txtJobPosting = XmlTemplate::replaceTemplateTags($tag, DateUtility::getRSSDate(strtotime($row['dateCreatedSort'])), $txtJobPosting);
                         break;
                     case 'jobURL':
                         $uri = sprintf("%scareers/?p=showJob&ID=%d&ref=%s", substr(CATSUtility::getAbsoluteURI(), 0, -4), $row['jobOrderID'], $templateName);
                         $txtJobPosting = XmlTemplate::replaceTemplateTags($tag, $uri, $txtJobPosting);
                         break;
                     case 'jobID':
                         $txtJobPosting = XmlTemplate::replaceTemplateTags($tag, $row['jobOrderID'], $txtJobPosting);
                         break;
                     case 'hiringCompany':
                         $txtJobPosting = XmlTemplate::replaceTemplateTags($tag, 'CATS (www.catsone.com)', $txtJobPosting);
                         break;
                     case 'jobCity':
                         $txtJobPosting = XmlTemplate::replaceTemplateTags($tag, $row['city'], $txtJobPosting);
                         break;
                     case 'jobState':
                         $txtJobPosting = XmlTemplate::replaceTemplateTags($tag, $row['state'], $txtJobPosting);
                         break;
                         // FIXME: Make this expandable to non-US?
                     // FIXME: Make this expandable to non-US?
                     case 'jobCountry':
                         $txtJobPosting = XmlTemplate::replaceTemplateTags($tag, "US", $txtJobPosting);
                         break;
                     case 'jobZipCode':
                         $txtJobPosting = XmlTemplate::replaceTemplateTags($tag, '', $txtJobPosting);
                         break;
                     case 'jobDescription':
                         $txtJobPosting = XmlTemplate::replaceTemplateTags($tag, $row['jobDescription'], $txtJobPosting);
                         break;
                 }
             }
             $stream .= $txtJobPosting;
         }
     }
     $stream .= $templateFooter;
     echo $stream;
 }
示例#19
0
 /**
  * Checks remote server for a new version of CATS.  Also submits
  * usage information and license key for statistics tracking
  * purposes.
  *
  * @return void
  */
 public static function checkForUpdate()
 {
     $systemInfoDb = new SystemInfo();
     $systemInfo = $systemInfoDb->getSystemInfo();
     /* Set a UID number if it does not exist. */
     if ($systemInfo['uid'] == 0) {
         $randMax = mt_getrandmax();
         if ($randMax >= 100000000) {
             $randMax = 100000000;
         }
         $systemInfo['uid'] = mt_rand(1, $randMax);
         $systemInfoDb->updateUID($systemInfo['uid']);
     }
     if (!eval(Hooks::get('NEW_VERSION_CHECK_CHECK_FOR_UPDATE'))) {
         return;
     }
     /* Bail if the user disabled new version checking. */
     if ($systemInfo['disable_version_check']) {
         return;
     }
     if (isset($_SERVER['SERVER_SOFTWARE'])) {
         $serverSoftware = $_SERVER['SERVER_SOFTWARE'];
     } else {
         $serverSoftware = '';
     }
     if (isset($_SERVER['HTTP_USER_AGENT'])) {
         $userAgent = $_SERVER['HTTP_USER_AGENT'];
     } else {
         $userAgent = '';
     }
     //FIXME: Library code Session dependencies suck.
     $siteName = $_SESSION['CATS']->getSiteName();
     $catsVersion = CATSUtility::getVersionAsInteger();
     $users = new Users(1);
     $numberOfActiveUsers = $users->getUsageData();
     $licenseKey = LICENSE_KEY;
     /* Build POST data. */
     $postData = 'CatsVersion=' . urlencode($catsVersion);
     $postData .= '&CatsUID=' . urlencode($systemInfo['uid']);
     $postData .= '&PHPVersion=' . urlencode(phpversion());
     $postData .= '&ServerSoftware=' . urlencode($serverSoftware);
     $postData .= '&UserAgent=' . urlencode($userAgent);
     $postData .= '&SiteName=' . urlencode($siteName);
     $postData .= '&activeUsers=' . urlencode($numberOfActiveUsers);
     $postData .= '&licenseKey=' . urlencode($licenseKey);
     /* Hack for compatability with older CATS versions. */
     $postData .= '&CatsVersionAgain=' . urlencode($catsVersion);
     $theData = self::getDataFromServer('www.catsone.com', 80, '/catsnewversion.php', $postData);
     /* Check to see if getting information failed, if it did reset the weekly counter */
     if (strpos($theData, '(end of CATS version info)') == 0) {
         if (!empty($systemInfo['available_version'])) {
             $systemInfoDb->updateRemoteVersion($systemInfo['available_version'], $systemInfo['available_version_description'], date('Y-m-d'));
         } else {
             $systemInfoDb->updateRemoteVersion(0, $systemInfo['available_version_description'], date('Y-m-d'));
         }
         return;
     }
     /* Strip down the data into $remoteVersion and $newVersionNotice. */
     $temp = substr($theData, strpos($theData, '{<') + 2);
     $newVersionNotice = substr($temp, strpos($temp, '{<') + 2);
     $remoteVersion = substr($newVersionNotice, strpos($newVersionNotice, '{<') + 2);
     $newVersionNotice = substr($newVersionNotice, 0, strpos($newVersionNotice, '>}'));
     $remoteVersion = substr($remoteVersion, 0, strpos($remoteVersion, '>}'));
     $systemInfoDb->updateRemoteVersion($remoteVersion, $newVersionNotice, date('Y-m-d'));
 }
示例#20
0
 /**
  * Store the contents of a file upload in the site's upload directory with an
  * optional sub-directory and return the name of the file (not including path).
  *
  * @param integer ID of the site containing the file
  * @param string Optional sub-directory to place the file
  * @param string Index of the $_FILES array (name from the <input> tag)
  * @return string Complete name of the file (not including path)
  */
 public static function getUploadFileFromPost($siteID, $subDirectory, $id)
 {
     if (isset($_FILES[$id])) {
         if (!@file_exists($_FILES[$id]['tmp_name'])) {
             // File was removed, accessed from another window, or no longer exists
             return false;
         }
         if (!eval(Hooks::get('FILE_UTILITY_SPACE_CHECK'))) {
             return;
         }
         $uploadPath = FileUtility::getUploadPath($siteID, $subDirectory);
         $newFileName = $_FILES[$id]['name'];
         // Could just while(file_exists) it, but I'm paranoid of infinate loops
         // Shouldn't have 1000 files of the same name anyway
         for ($i = 0; @file_exists($uploadPath . '/' . $newFileName) && $i < 1000; $i++) {
             $mp = explode('.', $newFileName);
             $fileNameBase = implode('.', array_slice($mp, 0, count($mp) - 1));
             $fileNameExt = $mp[count($mp) - 1];
             if (preg_match('/(.*)_Copy([0-9]{1,3})$/', $fileNameBase, $matches)) {
                 // Copy already appending, increase the #
                 $fileNameBase = sprintf('%s_Copy%d', $matches[1], intval($matches[2]) + 1);
             } else {
                 $fileNameBase .= '_Copy1';
             }
             $newFileName = $fileNameBase . '.' . $fileNameExt;
         }
         if (@move_uploaded_file($_FILES[$id]['tmp_name'], $uploadPath . '/' . $newFileName) && @chmod($uploadPath . '/' . $newFileName, 0777)) {
             return $newFileName;
         }
     }
     return false;
 }
示例#21
0
文件: ajax.php 项目: rankinp/OpenCATS
    /* Split function parameter into module name and function name. */
    $parameters = explode(':', $_REQUEST['f']);
    $module = preg_replace("/[^A-Za-z0-9]/", "", $parameters[0]);
    $function = preg_replace("/[^A-Za-z0-9]/", "", $parameters[1]);
    $filename = sprintf('modules/%s/ajax/%s.php', $module, $function);
}
if (!is_readable($filename)) {
    header('Content-type: text/xml');
    echo '<?xml version="1.0" encoding="', AJAX_ENCODING, '"?>', "\n";
    echo "<data>\n" . "    <errorcode>-1</errorcode>\n" . "    <errormessage>Invalid function name.</errormessage>\n" . "</data>\n";
    die;
}
$filters = array();
if (!isset($_REQUEST['nobuffer'])) {
    include_once './lib/Hooks.php';
    ob_start();
    include $filename;
    $output = ob_get_clean();
    if (!eval(Hooks::get('AJAX_HOOK'))) {
        return;
    }
    if (!isset($_REQUEST['nospacefilter'])) {
        $output = preg_replace('/^\\s+/m', '', $output);
    }
    foreach ($filters as $filter) {
        eval($filter);
    }
    echo $output;
} else {
    include $filename;
}
示例#22
0
 /**
  * Support function for Quick Search code. Searches all relevant fields for
  * $wildCardString.
  *
  * @param string wildcard match string
  * @return array job orders data
  */
 public function jobOrders($wildCardString)
 {
     $wildCardString = str_replace('*', '%', $wildCardString) . '%';
     $wildCardString = $this->_db->makeQueryString($wildCardString);
     $sql = sprintf("SELECT\n                company.company_id AS companyID,\n                company.name AS companyName,\n                joborder.joborder_id AS jobOrderID,\n                joborder.title AS title,\n                joborder.type AS type,\n                joborder.is_hot AS isHot,\n                joborder.duration AS duration,\n                joborder.rate_max AS maxRate,\n                joborder.salary AS salary,\n                joborder.status AS status,\n                joborder.city AS city,\n                joborder.state AS state,\n                recruiter_user.first_name AS recruiterFirstName,\n                recruiter_user.last_name AS recruiterLastName,\n                owner_user.first_name AS ownerFirstName,\n                owner_user.last_name AS ownerLastName,\n                DATE_FORMAT(\n                    joborder.start_date, '%%m-%%d-%%y'\n                ) AS startDate,\n                DATE_FORMAT(\n                    joborder.date_created, '%%m-%%d-%%y'\n                ) AS dateCreated,\n                DATE_FORMAT(\n                    joborder.date_modified, '%%m-%%d-%%y'\n                ) AS dateModified\n            FROM\n                joborder\n            LEFT JOIN company\n                ON joborder.company_id = company.company_id\n            LEFT JOIN user AS recruiter_user\n                ON joborder.recruiter = recruiter_user.user_id\n            LEFT JOIN user AS owner_user\n                ON joborder.owner = owner_user.user_id\n            WHERE\n            (\n                company.name LIKE %s\n                OR joborder.title LIKE %s\n            )\n            AND\n                joborder.is_admin_hidden = 0\n            AND\n                joborder.site_id = %s\n            AND\n                company.site_id = %s\n            ORDER BY\n                name ASC", $wildCardString, $wildCardString, $this->_siteID, $this->_siteID);
     if (!eval(Hooks::get('JO_SEARCH_SQL'))) {
         return;
     }
     if (!eval(Hooks::get('JO_SEARCH_BY_EVERYTHING'))) {
         return;
     }
     return $this->_db->getAllAssoc($sql);
 }
示例#23
0
    ModuleUtility::loadModule('careers');
} else {
    if (isset($rssPage) && $rssPage) {
        ModuleUtility::loadModule('rss');
    } else {
        if (isset($xmlPage) && $xmlPage) {
            ModuleUtility::loadModule('xml');
        } else {
            if ($_SESSION['CATS']->isLoggedIn() && (!isset($_GET['m']) || ModuleUtility::moduleRequiresAuthentication($_GET['m'])) && $_SESSION['CATS']->checkForceLogout()) {
                // FIXME: Unset session / etc.?
                ModuleUtility::loadModule('login');
            } else {
                if (!isset($_GET['m']) || empty($_GET['m'])) {
                    if ($_SESSION['CATS']->isLoggedIn()) {
                        $_SESSION['CATS']->logPageView();
                        if (!eval(Hooks::get('INDEX_LOAD_HOME'))) {
                            return;
                        }
                        ModuleUtility::loadModule('home');
                    } else {
                        ModuleUtility::loadModule('login');
                    }
                } else {
                    if ($_GET['m'] == 'logout') {
                        /* There isn't really a logout module. It's just a few lines. */
                        $unixName = $_SESSION['CATS']->getUnixName();
                        $_SESSION['CATS']->logout();
                        unset($_SESSION['CATS']);
                        unset($_SESSION['modules']);
                        $URI = 'm=login';
                        /* Local demo account doesn't relogin. */
示例#24
0
    public function onDeleteEvent()
    {
        if ($this->_accessLevel < ACCESS_LEVEL_DELETE)
        {
            CommonErrors::fatal(COMMONERROR_PERMISSION, $this, 'Invalid user level for action.');
        }

        /* Bail out if we don't have a valid event ID. */
        if (!$this->isRequiredIDValid('eventID', $_GET))
        {
            CommonErrors::fatal(COMMONERROR_BADINDEX, $this, 'Invalid event ID.');
        }

        $eventID = $_GET['eventID'];

        if (!eval(Hooks::get('CALENDAR_DELETE_PRE'))) return;

        $calendar = new Calendar($this->_siteID);
        $calendar->deleteEvent($eventID);

        if (!eval(Hooks::get('CALENDAR_DELETE_POST'))) return;

        /* Transfer to same url without a=deleteEvent or eventID. */
        $newGet = $_GET;
        $newParams = array();

        unset($newGet['a']);
        unset($newGet['eventID']);

        foreach ($newGet AS $name => $value)
        {
            $newParams[] = urlencode($name).'='.urlencode($value);
        }

        CATSUtility::transferRelativeURI(implode('&', $newParams));
    }
示例#25
0
                            <a href='{$indexName}?m=joborders&a=show&jobOrderID={$pipelinesData['jobOrderID']}' class='{$pipelinesData['linkClass']}'>
                                {$pipelinesData['title']}
                            </a>
                        </td>
                        <td valign='top'>
                            <a href='{$indexName}?m=companies&companyID={$pipelinesData['companyID']}&a=show'>
                                {$pipelinesData['companyName']}
                            </a>
                        </td>
                        <td valign='top'>{$pipelinesData['ownerAbbrName']}</td>
                        <td valign='top'>{$pipelinesData['dateCreated']}</td>
                        <td valign='top'>{$pipelinesData['addedByAbbrName']}</td>
                        <td valign='top' nowrap='nowrap'>{$pipelinesData['status']}</td>";
 
    echo "<td align='center' nowrap='nowrap'>";
    eval(Hooks::get('CANDIDATE_TEMPLATE_SHOW_PIPELINE_ACTION'));

    if ($_SESSION['CATS']->getAccessLevel() >= ACCESS_LEVEL_EDIT && !$_SESSION['CATS']->hasUserCategory('sourcer'))
    {
        if ($pipelinesData['ratingValue'] < 0)
        {
            echo "<a href='#' id='screenLink{$pipelinesData['candidateJobOrderID']}' onclick=\"moImageValue{$pipelinesData['candidateJobOrderID']} = 0; setRating({$pipelinesData['candidateJobOrderID']}, 0, 'moImage{$pipelinesData['candidateJobOrderID']}', '".$_SESSION['CATS']->getCookie()." '); return false;\">
                <img id='screenImage{$pipelinesData['candidateJobOrderID']}' src='images/actions/screen.gif' width='16' height='16' class='absmiddle' alt='' border='0' title='Mark as Screened' />
            </a>";
        }
        else
        {
            echo "<img src='images/actions/blank.gif' width='16' height='16' class='absmiddle' alt='' border='0' />";
        }
    }
    if ($this->accessLevel >= ACCESS_LEVEL_EDIT)
示例#26
0
 public function massImport($step = 1)
 {
     if (isset($_SESSION['CATS']) && !empty($_SESSION['CATS'])) {
         $siteID = $_SESSION['CATS']->getSiteID();
     } else {
         CommonErrors::fatal(COMMONERROR_NOTLOGGEDIN, $this);
     }
     if ($_SESSION['CATS']->getAccessLevel() < ACCESS_LEVEL_EDIT) {
         CommonErrors::fatal(COMMONERROR_PERMISSION, $this, 'You do not have permission to import ' . 'mass resume documents.');
     }
     // Figure out what stage of the process we're on
     if (isset($_GET['step']) && ($step = intval($_GET['step'])) >= 1 && $step <= 4) {
     }
     $this->_template->assign('step', $step);
     if ($step == 1) {
         if (isset($_SESSION['CATS_PARSE_TEMP'])) {
             unset($_SESSION['CATS_PARSE_TEMP']);
         }
         $uploadDir = FileUtility::getUploadPath($siteID, 'massimport');
         $files = ImportUtility::getDirectoryFiles($uploadDir);
         if (is_array($files) && count($files)) {
             // User already has files for upload
             $this->_template->assign('documents', $files);
         }
         // Figure out the path to post resumes
         $script = $_SERVER['SCRIPT_FILENAME'];
         $mp = explode('/', $script);
         $rootPath = implode('/', array_slice($mp, 0, count($mp) - 1));
         $subPath = FileUtility::getUploadPath($siteID, 'massimport');
         if ($subPath !== false) {
             $uploadPath = $rootPath . '/' . $subPath . '/';
         } else {
             $uploadPath = false;
         }
         $this->_template->assign('flashUploaderEnabled', file_exists('modules/asp') ? true : false);
         $this->_template->assign('multipleFilesEnabled', true);
         $this->_template->assign('uploadPath', $uploadPath);
     } else {
         if ($step == 2) {
             /**
              * Step 1: Find any uploaded files and get them into an array.
              */
             if (isset($_SESSION['CATS_PARSE_TEMP'])) {
                 unset($_SESSION['CATS_PARSE_TEMP']);
             }
             $uploadDir = FileUtility::getUploadPath($siteID, 'massimport');
             $files = ImportUtility::getDirectoryFiles($uploadDir);
             if ($files === -1 || !is_array($files) || !count($files)) {
                 $this->_template->assign('errorMessage', 'You didn\'t upload any files or there was a ' . 'problem working with any files you uploaded. Please use the ' . '<a href="javascript:back()"><b>Back</b></a> button on your web browser ' . 'and select one or more files to import.');
                 $this->_template->assign('files', array());
                 $this->_template->assign('js', '');
             } else {
                 if (!eval(Hooks::get('MASS_IMPORT_SPACE_CHECK'))) {
                     return;
                 }
                 // Build the javascript to handle the ajax parsing (for progress bar)
                 $js = '';
                 foreach ($files as $fileData) {
                     $js .= sprintf('addDocument(\'%s\', \'%s\', \'%s\', %d, %d);%s', addslashes($fileData['name']), addslashes($fileData['realName']), addslashes($fileData['ext']), $fileData['type'], $fileData['cTime'], "\n");
                 }
                 $this->_template->assign('files', $files);
                 $this->_template->assign('js', $js);
             }
         } else {
             if ($step == 3) {
                 // Make sure the processed files exists, is an array, and is not empty
                 list($documents, $success, $failed) = $this->getMassImportDocuments();
                 if (!count($documents)) {
                     $this->_template->assign('errorMessage', 'None of the files you uploaded were able ' . 'to be imported!');
                 }
                 $this->_template->assign('documents', $documents);
             } else {
                 if ($step == 4) {
                     // Final step, import all applicable candidates
                     list($importedCandidates, $importedDocuments, $importedFailed, $importedDuplicates) = $this->getMassImportCandidates();
                     if (!count($importedCandidates) && !count($importedDocuments) && !count($importedFailed) && !count($importedDuplicates)) {
                         $this->_template->assign('errorMessage', '<b style="font-size: 20px;">Information no Longer ' . 'Available</b><br /><br />' . 'Ooops! You probably used the <b>back</b> or <b>refresh</b> ' . 'buttons on your browser. The information you previously had here is no longer ' . 'available. To start a new ' . 'mass resume import, <a style="font-size: 16px;" href="' . CATSUtility::getIndexName() . '?m=import&a=massImport&' . 'step=1">click here</a>.');
                     }
                     //if (!eval(Hooks::get('IMPORT_NOTIFY_DEV'))) return;
                     $this->_template->assign('importedCandidates', $importedCandidates);
                     $this->_template->assign('importedDocuments', $importedDocuments);
                     $this->_template->assign('importedFailed', $importedFailed);
                     $this->_template->assign('importedDuplicates', $importedDuplicates);
                     unset($_SESSION['CATS_PARSE_TEMP']);
                 } else {
                     if ($step == 99) {
                         // User wants to delete all files in their upload folder
                         $uploadDir = FileUtility::getUploadPath($siteID, 'massimport');
                         $files = ImportUtility::getDirectoryFiles($uploadDir);
                         if (is_array($files) && count($files)) {
                             foreach ($files as $file) {
                                 @unlink($file['name']);
                             }
                         }
                         echo 'Ok';
                         return;
                     }
                 }
             }
         }
     }
     $this->_template->assign('active', $this);
     // ->isDemo() doesn't work here... oddly.
     $this->_template->assign('isDemo', $_SESSION['CATS']->getSiteID() == 201);
     // Build the sub-template to pass to the container
     ob_start();
     $this->_template->display(sprintf('./modules/import/MassImportStep%d.tpl', $step));
     $subTemplateContents = ob_get_contents();
     ob_end_clean();
     // Show the main template (the container with the large status sections)
     $this->_template->assign('subTemplateContents', $subTemplateContents);
     $this->_template->display('./modules/import/MassImport.tpl');
 }
if (!isset($_POST['id']) || !$interface->isRequiredIDValid('id')) {
    $interface->outputXMLErrorPage(-2, 'No attachment ID specified.');
    die;
}
$attachmentID = $_POST['id'];
$attachments = new Attachments(-1);
$rs = $attachments->get($attachmentID, false);
if (!isset($rs['directoryName']) || !isset($rs['storedFilename']) || md5($rs['directoryName']) != $_POST['directoryNameHash']) {
    $interface->outputXMLErrorPage(-2, 'Invalid directory name hash.');
    die;
}
$directoryName = $rs['directoryName'];
$fileName = $rs['storedFilename'];
/* Check for the existence of the backup.  If it is gone, send the user to a page informing them to press back and generate the backup again. */
if ($rs['contentType'] == 'catsbackup') {
    if (!file_exists('attachments/' . $directoryName . '/' . $fileName)) {
        $interface->outputXMLErrorPage(-2, 'The specified backup file no longer exists.  Please press back and regenerate the backup before downloading.  We are sorry for the inconvenience.');
        die;
    }
}
$url = 'attachments/' . $directoryName . '/' . $fileName;
if (!eval(Hooks::get('ATTACHMENT_RETRIEVAL'))) {
    return;
}
if (!file_exists('attachments/' . $directoryName . '/' . $fileName)) {
    $interface->outputXMLErrorPage(-2, 'The file is temporarily unavailable for download.  Please try again.');
    die;
}
$output = "<data>\n" . "    <errorcode>0</errorcode>\n" . "    <errormessage></errormessage>\n" . "    <success>1</success>\n" . "</data>\n";
/* Send back the XML data. */
$interface->outputXMLPage($output);
示例#28
0
 /**
  * Returns the sql statment for the pager.
  *
  * @return array clients data
  */
 public function getSQL($selectSQL, $joinSQL, $whereSQL, $havingSQL, $orderSQL, $limitSQL, $distinct = '')
 {
     // FIXME: Factor out Session dependency.
     if ($_SESSION['CATS']->isLoggedIn() && $_SESSION['CATS']->getAccessLevel() < ACCESS_LEVEL_MULTI_SA) {
         $adminHiddenCriterion = 'AND joborder.is_admin_hidden = 0';
     } else {
         $adminHiddenCriterion = '';
     }
     if ($this->getMiscArgument() != 0) {
         $savedListID = (int) $this->getMiscArgument();
         $joinSQL .= ' INNER JOIN saved_list_entry
                                 ON saved_list_entry.data_item_type = ' . DATA_ITEM_JOBORDER . '
                                 AND saved_list_entry.data_item_id = joborder.joborder_id
                                 AND saved_list_entry.site_id = ' . $this->_siteID . '
                                 AND saved_list_entry.saved_list_id = ' . $savedListID;
     } else {
         $joinSQL .= ' LEFT JOIN saved_list_entry
                                 ON saved_list_entry.data_item_type = ' . DATA_ITEM_JOBORDER . '
                                 AND saved_list_entry.data_item_id = joborder.joborder_id
                                 AND saved_list_entry.site_id = ' . $this->_siteID;
     }
     if (!eval(Hooks::get('JOBORDER_DATAGRID_GETSQL'))) {
         return;
     }
     $sql = sprintf("SELECT SQL_CALC_FOUND_ROWS %s\n                joborder.joborder_id AS jobOrderID,\n                joborder.joborder_id AS exportID,\n                joborder.date_modified AS dateModifiedSort,\n                joborder.date_created AS dateCreatedSort,\n                joborder.is_hot AS isHot,\n            %s\n            FROM\n                joborder\n            LEFT JOIN company\n                ON joborder.company_id = company.company_id\n            LEFT JOIN contact\n                ON joborder.contact_id = contact.contact_id\n            LEFT JOIN attachment\n                ON joborder.joborder_id = attachment.data_item_id\n                AND attachment.data_item_type = %s\n            %s\n            WHERE\n                joborder.site_id = %s\n            %s\n            %s\n            %s\n            GROUP BY joborder.joborder_id\n            %s\n            %s\n            %s", $distinct, $selectSQL, DATA_ITEM_JOBORDER, $joinSQL, $this->_siteID, $adminHiddenCriterion, strlen($whereSQL) > 0 ? ' AND ' . $whereSQL : '', $this->_assignedCriterion, strlen($havingSQL) > 0 ? ' HAVING ' . $havingSQL : '', $orderSQL, $limitSQL);
     return $sql;
 }
示例#29
0
                    <td class="data"><?php $this->_($this->data['recruiterFullName']); ?></td>
                </tr>

                <tr>
                    <td class="vertical">Owner:</td>
                    <td class="data"><?php $this->_($this->data['ownerFullName']); ?></td>
                </tr>

                <?php for ($i = (intval(count($this->extraFieldRS))/2); $i < (count($this->extraFieldRS)); $i++): ?>
                    <tr>
                        <td class="vertical"><?php $this->_($this->extraFieldRS[$i]['fieldName']); ?>:</td>
                        <td class="data"><?php echo($this->extraFieldRS[$i]['display']); ?></td>
                    </tr>
                <?php endfor; ?>

                <?php eval(Hooks::get('JO_TEMPLATE_SHOW_BOTTOM_OF_RIGHT')); ?>
            </table>
        </td>
    </tr>
</table>

<?php if ($this->isPublic): ?>
<div style="background-color: #E6EEFE; padding: 10px; margin: 5px 0 12px 0; border: 1px solid #728CC8;">
    <b>This job order is public<?php if ($this->careerPortalURL === false): ?>.</b><?php else: ?>
        and will be shown on your
        <?php if ($_SESSION['CATS']->getAccessLevel() >= ACCESS_LEVEL_SA): ?>
            <a style="font-weight: bold;" href="<?php $this->_($this->careerPortalURL); ?>">Careers Website</a>.
        <?php else: ?>
            Careers Website.
        <?php endif; ?></b>
    <?php endif; ?>
示例#30
0
 /**
  * Processes an Add Activity / Schedule Event form and displays
  * contacts/AddActivityScheduleEventModal.tpl. This is factored out
  * for code clarity.
  *
  * @param boolean from joborders module perspective
  * @param integer "regarding" job order ID or -1
  * @param string module directory
  * @return void
  */
 private function _addActivityScheduleEvent($regardingID, $directoryOverride = '')
 {
     /* Module directory override for fatal() calls. */
     if ($directoryOverride != '') {
         $moduleDirectory = $directoryOverride;
     } else {
         $moduleDirectory = $this->_moduleDirectory;
     }
     /* Bail out if we don't have a valid candidate ID. */
     if (!$this->isRequiredIDValid('contactID', $_POST)) {
         CommonErrors::fatalModal(COMMONERROR_BADINDEX, $this, 'Invalid contact ID.');
     }
     $contactID = $_POST['contactID'];
     //if (!eval(Hooks::get('CONTACT_ON_ADD_ACTIVITY_SCHEDULE_EVENT_PRE'))) return;
     if ($this->isChecked('addActivity', $_POST)) {
         /* Bail out if we don't have a valid job order ID. */
         if (!$this->isOptionalIDValid('activityTypeID', $_POST)) {
             CommonErrors::fatalModal(COMMONERROR_BADINDEX, $this, 'Invalid activity type ID.');
         }
         $activityTypeID = $_POST['activityTypeID'];
         $activityNote = $this->getTrimmedInput('activityNote', $_POST);
         $activityNote = htmlspecialchars($activityNote);
         /* Add the activity entry. */
         $activityEntries = new ActivityEntries($this->_siteID);
         $activityID = $activityEntries->add($contactID, DATA_ITEM_CONTACT, $activityTypeID, $activityNote, $this->_userID, $regardingID);
         $activityTypes = $activityEntries->getTypes();
         $activityTypeDescription = ResultSetUtility::getColumnValueByIDValue($activityTypes, 'typeID', $activityTypeID, 'type');
         $activityAdded = true;
     } else {
         $activityAdded = false;
         $activityNote = '';
         $activityTypeDescription = '';
     }
     if ($this->isChecked('scheduleEvent', $_POST)) {
         /* Bail out if we received an invalid date. */
         $trimmedDate = $this->getTrimmedInput('dateAdd', $_POST);
         if (empty($trimmedDate) || !DateUtility::validate('-', $trimmedDate, DATE_FORMAT_MMDDYY)) {
             CommonErrors::fatalModal(COMMONERROR_MISSINGFIELDS, $this, 'Invalid date.');
         }
         /* Bail out if we don't have a valid event type. */
         if (!$this->isRequiredIDValid('eventTypeID', $_POST)) {
             CommonErrors::fatalModal(COMMONERROR_BADINDEX, $this, 'Invalid event type ID.');
         }
         /* Bail out if we don't have a valid time format ID. */
         if (!isset($_POST['allDay']) || $_POST['allDay'] != '0' && $_POST['allDay'] != '1') {
             CommonErrors::fatalModal(COMMONERROR_MISSINGFIELDS, $this, 'Invalid time format ID.');
         }
         $eventTypeID = $_POST['eventTypeID'];
         if ($_POST['allDay'] == 1) {
             $allDay = true;
         } else {
             $allDay = false;
         }
         $publicEntry = $this->isChecked('publicEntry', $_POST);
         $reminderEnabled = $this->isChecked('reminderToggle', $_POST);
         $reminderEmail = $this->getTrimmedInput('sendEmail', $_POST);
         $reminderTime = $this->getTrimmedInput('reminderTime', $_POST);
         $duration = -1;
         /* Is this a scheduled event or an all day event? */
         if ($allDay) {
             $date = DateUtility::convert('-', $trimmedDate, DATE_FORMAT_MMDDYY, DATE_FORMAT_YYYYMMDD);
             $hour = 12;
             $minute = 0;
             $meridiem = 'AM';
         } else {
             /* Bail out if we don't have a valid hour. */
             if (!isset($_POST['hour'])) {
                 CommonErrors::fatalModal(COMMONERROR_MISSINGFIELDS, $this, 'Invalid hour.');
             }
             /* Bail out if we don't have a valid minute. */
             if (!isset($_POST['minute'])) {
                 CommonErrors::fatalModal(COMMONERROR_MISSINGFIELDS, $this, 'Invalid minute.');
             }
             /* Bail out if we don't have a valid meridiem value. */
             if (!isset($_POST['meridiem']) || $_POST['meridiem'] != 'AM' && $_POST['meridiem'] != 'PM') {
                 CommonErrors::fatalModal(COMMONERROR_MISSINGFIELDS, $this, 'Invalid meridiem value.');
             }
             $hour = $_POST['hour'];
             $minute = $_POST['minute'];
             $meridiem = $_POST['meridiem'];
             /* Convert formatted time to UNIX timestamp. */
             $time = strtotime(sprintf('%s:%s %s', $hour, $minute, $meridiem));
             /* Create MySQL date string w/ 24hr time (YYYY-MM-DD HH:MM:SS). */
             $date = sprintf('%s %s', DateUtility::convert('-', $trimmedDate, DATE_FORMAT_MMDDYY, DATE_FORMAT_YYYYMMDD), date('H:i:00', $time));
         }
         $description = $this->getTrimmedInput('description', $_POST);
         $title = $this->getTrimmedInput('title', $_POST);
         /* Bail out if any of the required fields are empty. */
         if (empty($title)) {
             CommonErrors::fatalModal(COMMONERROR_MISSINGFIELDS, $this, 'Required fields are missing.');
         }
         if ($regardingID > 0) {
             $eventJobOrderID = $regardingID;
         } else {
             $eventJobOrderID = -1;
         }
         $calendar = new Calendar($this->_siteID);
         $eventID = $calendar->addEvent($eventTypeID, $date, $description, $allDay, $this->_userID, $contactID, DATA_ITEM_CONTACT, $eventJobOrderID, $title, $duration, $reminderEnabled, $reminderEmail, $reminderTime, $publicEntry, $_SESSION['CATS']->getTimeZoneOffset());
         if ($eventID <= 0) {
             CommonErrors::fatalModal(COMMONERROR_RECORDERROR, $this, 'Failed to add calendar event.');
         }
         /* Extract the date parts from the specified date. */
         $parsedDate = strtotime($date);
         $formattedDate = date('l, F jS, Y', $parsedDate);
         $calendar = new Calendar($this->_siteID);
         $calendarEventTypes = $calendar->getAllEventTypes();
         $eventTypeDescription = ResultSetUtility::getColumnValueByIDValue($calendarEventTypes, 'typeID', $eventTypeID, 'description');
         $eventHTML = sprintf('<p>An event of type <span class="bold">%s</span> has been scheduled on <span class="bold">%s</span>.</p>', htmlspecialchars($eventTypeDescription), htmlspecialchars($formattedDate));
         $eventScheduled = true;
     } else {
         $eventHTML = '<p>No event has been scheduled.</p>';
         $eventScheduled = false;
     }
     if (isset($_GET['onlyScheduleEvent'])) {
         $onlyScheduleEvent = true;
     } else {
         $onlyScheduleEvent = false;
     }
     if (!$activityAdded && !$eventScheduled) {
         $changesMade = false;
     } else {
         $changesMade = true;
     }
     if (!eval(Hooks::get('CANDIDATE_ON_ADD_ACTIVITY_CHANGE_STATUS_POST'))) {
         return;
     }
     $this->_template->assign('contactID', $contactID);
     $this->_template->assign('regardingID', $regardingID);
     $this->_template->assign('activityAdded', $activityAdded);
     $this->_template->assign('activityDescription', $activityNote);
     $this->_template->assign('activityType', $activityTypeDescription);
     $this->_template->assign('eventScheduled', $eventScheduled);
     $this->_template->assign('onlyScheduleEvent', $onlyScheduleEvent);
     $this->_template->assign('eventHTML', $eventHTML);
     $this->_template->assign('changesMade', $changesMade);
     $this->_template->assign('isFinishedMode', true);
     $this->_template->display('./modules/contacts/AddActivityScheduleEventModal.tpl');
 }