Exemplo n.º 1
0
<?php

require dirname(dirname(__DIR__)) . '/legacy/git-bootstrap.php';
require_once 'autoload.php';
PSU::session_start();
$config = new PSU\Config();
$config->load();
define('PSU_API_APPID', $config->get('ape', 'api_appid'));
define('PSU_API_APPKEY', $config->get('ape', 'api_key'));
/*******************[Site Constants]*****************/
// Base directory of application
$GLOBALS['BASE_DIR'] = dirname(__FILE__);
// Base URL
PSU::get()->base_url = $GLOBALS['BASE_URL'] = $config->get('ape', 'base_url');
if (file_exists('debug.php')) {
    // 1. debug.php should override $GLOBALS['BASE_URL'] and PSU::get()->base_url
    // 2. also modify auto_prepend_file and RewriteBase in .htaccess, but make sure you don't commit those changes
    include 'debug.php';
}
if (isset($_GET['go'])) {
    PSU::redirect($config->get('ape', 'base_url') . '/user/' . $_GET['go']);
}
// Local Includes
$GLOBALS['LOCAL_INCLUDES'] = $GLOBALS['BASE_DIR'] . '/includes';
// Temp
$GLOBALS['TMP'] = '/web/temp';
// Templates
$GLOBALS['TEMPLATES'] = $GLOBALS['BASE_DIR'] . '/templates';
// Icons
$GLOBALS['ICONS'] = $config->get('app_url') . '/core/images/my/icons';
// Javascript
<?php

ini_set('memory_limit', -1);
require_once 'autoload.php';
require_once 'PSUWordPress.php';
if (substr(php_sapi_name(), 0, 3) == 'cli') {
    $config = new PSU\Config();
    $config->load();
    $GLOBALS['BASE_DIR'] = dirname(__FILE__) . '/..';
    $GLOBALS['BASE_URL'] = $config->get('ape', 'base_url');
    $GLOBALS['TEMPLATES'] = $GLOBALS['BASE_DIR'] . '/templates';
    $command_line = true;
    require_once $GLOBALS['BASE_DIR'] . '/includes/HRChecklist.class.php';
    $cron = new cron('checklist-trigger', 'page_threshold=20');
    if ($cron->checkLock()) {
        $cron->log('Employee Exit Checklist Trigger is already running');
        exit;
    }
    //end if
    $cron->lock();
}
//end if
$time = time();
$one_month_ago = strtotime('-1 month');
$sql = "SELECT * FROM v_emp_clearance_candidates";
if ($results = PSU::db('banner')->Execute($sql)) {
    foreach ($results as $row) {
        if ($checklist = HRChecklist::get($row['pidm'], 'employee-exit')) {
            if ($checklist['position_code'] == $row['position_code'] && strtotime($checklist['activity_date']) >= $one_month_ago) {
                continue;
            }