/**
  * Default handler to display index
  */
 public function index()
 {
     IDMObject::authN();
     if (isset($_GET['go'])) {
         $ticket_id = (int) $_GET['go'];
         PSU::redirect($GLOBALS['BASE_URL'] . '/ticket/' . $ticket_id);
     }
     $this->tpl->assign('open_calls', $this->_get_calls('open', $_GET['open_page'] ? $_GET['open_page'] : 1));
     $this->tpl->assign('closed_calls', $this->_get_calls('closed', $_GET['closed_page'] ? $_GET['closed_page'] : 1));
     $this->tpl->display('index.tpl');
 }
 public function _submit()
 {
     $f = $_POST;
     $app = new WoodwindApply($f);
     list($required, $filled, $percent) = $app->progress();
     $_SESSION['woodwind-day']['f'] = $app->form();
     if ($percent < 1) {
         $_SESSION['errors'][] = 'Please fill in all required fields.';
         PSU::redirect($GLOBALS['BASE_URL'] . '/register');
     }
     if ($id = $app->save()) {
         WoodwindAPI::mail($id);
     } else {
         $_SESSION['errors'][] = 'There was an error saving your submission data.';
         PSU::redirect($GLOBALS['BASE_URL'] . '/register');
     }
     PSU::redirect($GLOBALS['BASE_URL'] . '/thank-you');
 }
Пример #3
0
<?php

PSU::get()->banner = PSU::db('psc1');
respond('/?', function ($request, $response, $app) {
    $ecommerce_running = shell_exec('ps ef | grep ecommerce_process.php | grep -v grep');
    if ($ecommerce_running) {
        $_SESSION['messages'][] = 'The ECommerce processing script is currently running. Reload to check the status.';
        $app->tpl->assign('ecommerce_processing', true);
    }
    //end if
    $app->tpl->assign('ecommerce_pending_files', \PSU\Ecommerce::pending_files());
    $app->tpl->assign('ecommerce_pending', \PSU\Ecommerce::pending());
    $app->tpl->assign('ecommerce_files', \PSU\Ecommerce::file_info());
    $app->tpl->assign('ecommerce_report', \PSU\Ecommerce::report());
    $app->tpl->display('ecommerce.tpl');
});
respond('/process', function ($request, $response, $app) {
    $user = PSU::isDev() ? 'nrporter' : 'webguru';
    if (PSU::isDev() && !IDMObject::authN('mis')) {
        return;
    }
    //end if
    $command = '~' . $user . '/scripts/ecommerce_process.php --instance=' . strtolower(PSU::db('banner')->database) . ' &';
    exec($command);
    $_SESSION['successes'][] = 'The ECommerce processing script has begun.  Please check back shortly.';
    PSU::redirect($GLOBALS['BASE_URL']);
});
        foreach ((array) $_SESSION['AUTHZ']['permission'] as $key => $value) {
            if (strpos($key, 'ape_') === 0) {
                unset($_SESSION['AUTHZ']['permission'][$key]);
            }
            //end if
        }
        //end foreach
        $message = 'Now impersonating: ' . $_SESSION['username'] . ' (' . $_SESSION['wp_id'] . ')';
        $_SESSION['messages'][] = $message;
    } elseif ($action == 'cancel') {
        if (isset($_SESSION['impersonate'])) {
            $GLOBALS['LOG']->write('Finished impersonating account', $_SESSION['username']);
            $_SESSION['wp_id'] = $_SESSION['impersonate_store']['wp_id'];
            $_SESSION['username'] = $_SESSION['impersonate_store']['username'];
            $_SESSION['pidm'] = $_SESSION['impersonate_store']['pidm'];
            $_SESSION['fullname'] = $_SESSION['impersonate_store']['fullname'];
            $_SESSION['phpCAS']['user'] = $_SESSION['impersonate_store']['username'];
            unset($_SESSION['AUTHZ']);
            PSU::get('idmobject')->loadAuthZ($_SESSION['pidm']);
            unset($_SESSION['impersonate_store'], $_SESSION['impersonate']);
        }
        //end if
        PSU::redirect($_SERVER['HTTP_REFERER']);
    } else {
        throw new Exception('Stop trying to sneak in here!!!');
    }
    //end else
} catch (Exception $e) {
    $_SESSION['errors'][] = sprintf("%s (%d)", $e->GetMessage(), $e->GetCode());
}
PSUHTML::redirect($GLOBALS['BASE_URL'] . '/user/' . $redirect_id);
Пример #5
0
});
respond('/?', function ($request, $response, $app) {
    $contracts = new PSU\AR\PaymentPlan\Feed\Contracts(10);
    $disbursements = new PSU\AR\PaymentPlan\Feed\Disbursements(4);
    $app->tpl->assign('date_format', '%b %e @ %l:%M %P');
    $app->tpl->assign('contracts', $contracts);
    $app->tpl->assign('disbursements', $disbursements);
    $app->tpl->display('payment-plans.tpl');
});
respond('/process/[contract|disbursement:script]', function ($request, $response, $app) {
    $script = $request->script;
    if ($app->running[$script]) {
        PSU::redirect($GLOBALS['BASE_URL'] . '/payment-plans');
    }
    //end if
    $user = PSU::isDev() ? 'nrporter' : 'webguru';
    if (PSU::isDev() && !IDMObject::authZ('permission', 'mis')) {
        $_SESSION['errors'][] = 'Only MIS can run this script in development';
        PSU::redirect($GLOBALS['BASE_URL'] . '/payment-plans');
    }
    //end if
    if ('contract' == $script) {
        $command = '/usr/local/bin/php ~' . $user . '/scripts/payment_plan_' . $script . '.php -i ' . strtolower(PSU::db('banner')->database) . ' &';
    } else {
        $command = '/usr/local/bin/php ~' . $user . '/scripts/payment_plan_' . $script . '.php --instance=' . strtolower(PSU::db('banner')->database) . ' &';
    }
    //end else
    exec($command);
    $_SESSION['successes'][] = 'The Payment Plan ' . ucwords($script) . ' processing script has begun.  Please check back shortly.';
    PSU::redirect($GLOBALS['BASE_URL'] . '/payment-plans');
});
 public function update()
 {
     $result = CDNAPI::update($_POST['cdnfiles'], $_SESSION['wp_id']);
     PSU::redirect($GLOBALS['BASE_URL'] . '/path' . $_POST['from']);
 }
Пример #7
0
$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
$GLOBALS['COMMON_JS'] = $config->get('app_url') . '/core/js';
// Javascript
$GLOBALS['JS'] = $config->get('ape', 'base_url') . '/js';
$GLOBALS['IDCARD_URL'] = $config->get('idcard', 'base_url');
// IDM "Source" name
$wp_id = $_GET['wp_id'];
$type = $_GET['type'] == 'email_alt' ? 'email_alt' : 'user_email';
$email = strtolower($_GET['email']);
$redirect_to = $GLOBALS['BASE_URL'];
if (!$wp_id) {
    $_SESSION['errors'][] = 'wp_id was missing from request. How\'d that happen?';
    PSU::redirect($redirect_to);
}
$person = new PSUPerson($wp_id);
$user = get_userdatabylogin($person->wp_id);
update_usermeta($user->ID, 'psuname', $person->login_name);
$redirect_to .= '/user/' . $wp_id;
if ($person->wp_id != $wp_id) {
    $_SESSION['errors'][] = 'Problem fetching user with wp_id ' . htmlentities($wp_id) . '.';
    PSU::redirect($redirect_to);
}
if (!$email) {
    $_SESSION['messages'][] = 'Email address was blank; updated username only.';
    PSU::redirect($redirect_to);
}
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
    $_SESSION['errors'][] = 'Invalid email address provided: ' . htmlentities($email);
    PSU::redirect($redirect_to);
}
//
// validation done; do link
//
$ticket = sl_initiate_link($person->wp_id, $email, $type);
$_SESSION['messages'][] = 'Ticket created: ' . $ticket;
PSU::redirect($redirect_to);
 /**
  * redirects if not admin
  */
 private function _force_admin()
 {
     if (!IDMObject::authZ('role', 'myplymouth')) {
         $_SESSION['errors'][] = 'You are not allowed to view the MyPlymouth administration interface.';
         PSU::redirect($GLOBALS['BASE_URL']);
     }
     //end if
 }
Пример #10
0
    $_POST['location_building_id'] = 0;
    $_POST['location_building_room_number'] = '';
    $_POST['location_call_logged_from'] = $_GET['call_source'] == 'support' ? 'support' : 'feedback';
} elseif ($_SERVER['SCRIPT_NAME'] == '/webapp/calllog/update_call_details.html' && $_POST && $_GET['ticket'] && $_GET['call_source'] == 'support') {
    $_POST['problem_details'] = filter_var($_POST['problem_details'], FILTER_SANITIZE_STRING);
    $prevent_file_upload = true;
    $GLOBALS['end_user_email'] = true;
    $person = new PSUPerson($_SESSION['username']);
    $_POST['call_id'] = $_GET['call_id'] = (int) $_GET['ticket'];
    $call = $db->GetRow("SELECT * FROM call_log WHERE call_id = ?", array($_GET['call_id']));
    $_POST['title'] = $call['title'];
    $_POST['feelings'] = $call['feelings'];
    $_POST['feelings_face'] = $call['feelings_face'];
    $max_history = $db->GetRow("SELECT * FROM call_history WHERE call_id = ? AND current = 1", array($_GET['call_id']));
    if ($max_history['call_status'] == 'closed') {
        PSU::redirect($_GET['redirect']);
    }
    //end if
    $_POST['call_log_username'] = $_POST['caller_user_name'] = $person->username ? $person->username : $person->wp_id;
    $_POST['caller_first_name'] = $person->formatName('f');
    $_POST['caller_last_name'] = $person->formatName('l');
    if ($person->phones['OF'][0]) {
        $_POST['caller_phone_number'] = '(' . $person->phones['OF'][0]->phone_area . ')' . $person->phones['OF'][0]->phone_number;
    } else {
        $_POST['caller_phone_number'] = '';
    }
    //end else
    $_POST['its_assigned_group'] = $max_history['its_assigned_group'];
    if ($max_history['tlc_assigned_to'] != $person->username) {
        $_POST['tlc_assigned_to'] = $max_history['tlc_assigned_to'];
    } else {
<?php

global $unsent;
$missing = ugApplicants::appsMissingEmail();
$unsent = ugApplicants::getPopulation('unsent_myp_invite');
function _just_pidms($row)
{
    return $row['pidm'];
}
function _remove_unsent($row)
{
    global $unsent;
    return in_array($row['pidm'], $GLOBALS['unsent']) == false;
}
// $unsent should be an array of pidms
$unsent = array_map('_just_pidms', $unsent);
// trim users from $missing who no longer need an invite
$missing = array_filter($missing, '_remove_unsent');
// remove everyone left in $missing
foreach ($missing as $row) {
    ugApplicants::app_missing_email_resolved($row['pidm']);
}
PSU::redirect($GLOBALS['BASE_URL'] . '/provisioning.html');
 /**
  * Restore a session stashed by an admin emulating another user's layout.
  */
 public function restore_layout()
 {
     if (!isset($_SESSION['portal']['session_stashed'])) {
         $_SESSION['errors'][] = 'Could not find a stashed session to restore.';
         PSU::redirect($GLOBALS['BASE_URL']);
     }
     $session_stashed = $_SESSION['portal']['session_stashed'];
     unset($_SESSION['portal']['session_stashed']);
     $_SESSION = $session_stashed;
     $_SESSION['messages'][] = "Your session has been restored.";
     PSU::redirect($GLOBALS['BASE_URL'] . '/admin');
 }
 private function _redirect_authorization()
 {
     $authorized = $this->_check_authorization();
     if (!$authorized) {
         $_SESSION['errors'][] = 'Please verify that you are authorized to access this financial information.';
         PSU::redirect($GLOBALS['BASE_URL'] . '/verify');
     }
 }
respond('/', function ($request, $response, $app) {
    $app->tpl->display('index.tpl');
});
respond('/thank-you', function ($request, $response, $app) {
    $f = $_SESSION['mtecd']['f'];
    unset($_SESSION['mtecd']['f']);
    if (!$f) {
        PSU::redirect($GLOBALS['BASE_URL'] . '/');
    }
    $form = new PSU\Festivals\MusicCareerDay\Model($f);
    $form->readonly(true);
    $app->tpl->assign('form', $form);
    $app->tpl->display('thank_you.tpl');
});
respond('/_submit', function ($request, $response, $app) {
    $f = $_POST;
    $application = new PSU\Festivals\MusicCareerDay\Model($f);
    list($required, $filled, $percent) = $application->progress();
    $_SESSION['mtecd']['f'] = $application->form();
    if ($percent < 1) {
        $_SESSION['errors'][] = 'Please fill in all required fields.';
        PSU::redirect($GLOBALS['BASE_URL'] . '/apply');
    }
    if ($id = $application->save()) {
        $app->mail($id);
    } else {
        $_SESSION['errors'][] = 'There was an error saving your submission data.';
        PSU::redirect($GLOBALS['BASE_URL'] . '/apply');
    }
    PSU::redirect($GLOBALS['BASE_URL'] . '/thank-you');
});
 /**
  * logic to display a given tab and portal structure for the user
  *
  * @param $tab \b tab to load
  */
 public function index($tab = null)
 {
     if (!$tab) {
         PSU::redirect($GLOBALS['BASE_URL'] . '/tab/welcome');
     }
 }