Exemplo n.º 1
0
<?php

require_once '../includes/prepend.inc.php';
// Check that the user is properly authenticated
if (!isset($_SESSION['intUserAccountId'])) {
    // authenticate error
    QApplication::Redirect('./index.php');
} else {
    QApplication::$objUserAccount = UserAccount::Load($_SESSION['intUserAccountId']);
}
$strWarning = "";
$arrCheckedAssetCode = "";
$strJavaScriptCode = "";
if ($_POST && $_POST['method'] == 'complete_transaction') {
    /*
    Run error checking on the array of asset codes and the destination location
    If there are no errors, then you will add the transaction to the database.
    	That will include an entry in the Transaction and Asset Transaction table.
    	You will also have to change the asset.location_id to the destination location
    */
    $arrAssetCode = array_unique(explode('#', $_POST['result']));
    $blnError = false;
    $arrCheckedAssetCode = array();
    foreach ($arrAssetCode as $strAssetCode) {
        if ($strAssetCode) {
            // Begin error checking
            $objNewAsset = Asset::LoadByAssetCode($strAssetCode);
            if (!$objNewAsset instanceof Asset) {
                $blnError = true;
                $strWarning .= $strAssetCode . " - That asset code does not exist.<br />";
            } elseif ($objNewAsset->LocationId == 2) {
Exemplo n.º 2
0
 public static function Authenticate($intModuleId = null)
 {
     // If logins have been disabled for this site, log the user out
     if (QApplication::$TracmorSettings->DisableLogins) {
         QApplication::Logout();
     }
     if (array_key_exists('intUserAccountId', $_SESSION)) {
         $objUserAccount = UserAccount::Load($_SESSION['intUserAccountId']);
         if ($objUserAccount) {
             // Assign the UserAccount object to the globally available QApplication
             QApplication::$objUserAccount = $objUserAccount;
             // If they are not in the admin panel
             if ($intModuleId) {
                 $objRoleModule = RoleModule::LoadByRoleIdModuleId($objUserAccount->RoleId, $intModuleId);
                 // If they do not have access to this module
                 if (!$objRoleModule->AccessFlag) {
                     QApplication::Redirect('../common/trespass.php');
                 } else {
                     QApplication::$objRoleModule = $objRoleModule;
                 }
             } elseif (!$objUserAccount->AdminFlag) {
                 QApplication::Redirect('../common/trespass.php');
             }
         } else {
             QApplication::Redirect('../common/trespass.php');
         }
     } else {
         QApplication::Redirect('../login.php?strReferer=' . urlencode(QApplication::$RequestUri));
     }
 }
Exemplo n.º 3
0
 public static function Authenticate($intModuleId = null)
 {
     if (array_key_exists('intUserAccountId', $_SESSION)) {
         $objUserAccount = UserAccount::Load($_SESSION['intUserAccountId']);
         if ($objUserAccount) {
             // Assign the UserAccount object to the globally available QApplication
             QApplication::$objUserAccount = $objUserAccount;
             // If they are not in the admin panel
             if ($intModuleId) {
                 $objRoleModule = RoleModule::LoadByRoleIdModuleId($objUserAccount->RoleId, $intModuleId);
                 // If they do not have access to this module
                 if (!$objRoleModule->AccessFlag) {
                     QApplication::Redirect('../common/trespass.php');
                 } else {
                     QApplication::$objRoleModule = $objRoleModule;
                 }
             } elseif (!$objUserAccount->AdminFlag) {
                 QApplication::Redirect('../common/trespass.php');
             }
         } else {
             QApplication::Redirect('../common/trespass.php');
         }
     } else {
         QApplication::Redirect('../login.php');
     }
 }