Exemplo n.º 1
0
function getRequest($pkId)
{
    global $fmOrderDB, $request, $site_prefix, $port, $log;
    $log->debug("Get request using PK: " . $pkId);
    $pageUrl = urlencode($port . "{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}");
    /* Open the database and add ID to find command **/
    $requestFind = $fmOrderDB->newFindCommand('[WEB] Project Request');
    $requestFind->addFindCriterion('__pk_ID', '==' . $pkId);
    $requestFinds = $requestFind->execute();
    /** Check for errors and if so send to error processing and report to user */
    if (FileMaker::isError($requestFinds)) {
        $errorTitle = "FileMaker Error";
        $log->error($requestFinds->getMessage(), $requestFinds->getErrorString(), $pageUrl, $pkId, $site_prefix);
        processError($requestFinds->getMessage(), $requestFinds->getErrorString(), $pageUrl, $pkId, $errorTitle);
        exit;
    }
    /** Now pull all records of find command for Requests (Parent of Meta data) and pull the first record of the array */
    $requests = $requestFinds->getRecords();
    $request = $requests[0];
    $log->debug("Finished now have record with PK: " . $pkId);
}
Exemplo n.º 2
0
/**
 * For consistency this method will return a list of Show Titles (show_codes) by division in the same way spot
 * types, versions, and descriptor list operate. This method is like the buildSpotVersionsSessionArray() method
 * however thsi method is only for Show Titles. This method takes an array accounts then builds an array of titles
 * per account that is loaded in to the SESSION
 * @param $dbHandle FM DB handle
 * @param $accountArray String $_SESSION array of user_accounts all accounts associated with this user
 * @return array String array of show titles by account
 */
function buildShowCodesSessionArray($dbHandle, $accountArray, $requestPkId, $pageUrl)
{
    global $log, $noRecordsFound, $site_prefix;
    $showCodesArray = array();
    $showCodeSortFieldName = 'Show_Title_t';
    $webShowCodesLayoutName = "[WEB] Show Codes";
    $webShowCodesDivisionField = 'Programming_Type_t';
    $webShowCodesFind = $dbHandle->newFindCommand($webShowCodesLayoutName);
    foreach ($accountArray as $account) {
        $showCodeData = array();
        $webShowCodesFind->addFindCriterion($webShowCodesDivisionField, '==' . $account);
        $webShowCodesFind->addSortRule($showCodeSortFieldName, 1, FILEMAKER_SORT_ASCEND);
        $webShowCodesResults = $webShowCodesFind->execute();
        if (FileMaker::isError($webShowCodesResults)) {
            if ($webShowCodesResults->getCode() == $noRecordsFound) {
                // check for 401 or no record found
                $log->debug("No matching show codes results find");
                //If no records exist for the Programming_Type_t then load empty array for that division
                $showCodesArray[$account] = array();
            } else {
                $errorTitle = "FileMaker Error";
                $log->error($webShowCodesResults->getMessage(), $webShowCodesResults->getErrorString(), $pageUrl, $requestPkId, $site_prefix);
                processError($webShowCodesResults->getMessage(), $webShowCodesResults->getErrorString(), $pageUrl, $requestPkId, $errorTitle);
                exit;
            }
        } else {
            $showCodeItems = $webShowCodesResults->getRecords();
            foreach ($showCodeItems as $showItems) {
                $showCodeData[$showItems->getField('Show_Code_t')] = $showItems->getField('Show_Title_t');
            }
            $showCodesArray[$account] = $showCodeData;
        }
    }
    return $showCodesArray;
}
Exemplo n.º 3
0
    $canModify = userCanModifyRequest($okModify);
}
$projectTypesFind = $fmOrderDB->newFindCommand('[WEB] Project Request Types');
//Note: Locally 192.168.0.14 this field is 'Request Type' however in main line the field is 'Request_Type'
$projectTypesFind->addFindCriterion("Request_Type", "*");
$projectTypesResults = $projectTypesFind->execute();
if (FileMaker::isError($projectTypesResults)) {
    if ($projectTypesResults->getCode() == $noRecordsFound) {
        $log->debug("No records found in search of project types disable buttons and display");
        //created and empty project records types array to account for system that do not use have authorization to use OnRequest
        $projectTypeRecords = array();
        $showProjectTypes = false;
    } else {
        $errorTitle = "FileMaker Error";
        $log->error($projectTypesResults->getMessage(), $projectTypesResults->getErrorString(), $pageUrl, "N/A", $site_prefix);
        processError($projectTypesResults->getMessage(), $projectTypesResults->getErrorString(), $pageUrl, "N/A", $errorTitle);
        exit;
    }
} else {
    $projectTypeRecords = $projectTypesResults->getRecords();
}
//Variables used in the Algorithm to display project type button array of 4 by X buttons per row of 12 column grid
$projectTypeRecordCount = count($projectTypeRecords);
$maxTypesPerRow = 4;
$dynamicColumnLgClassText = "col-lg-";
$dynamicColumnXsClassText = "col-xs-";
$decrementColumnBy = 2;
//1. Do not include HTML header record until most processing is completed. The error page cannot be called "Redirected"
//after HTML header is called.
//2. Determine which header should be presented based on site level position
$headerToUse = getHeaderIncludeFileName(urldecode($pageUrl));
Exemplo n.º 4
0
function validateUser($site_prefix, $fullUrl, $siteSection, $viewCheck, $pluginToValidate)
{
    global $log;
    //currently set at 2 hour time out and is only checked per page load
    $sessionTimeoutMax = 7200;
    $log->debug("validateUser() - method called for section: " . $siteSection);
    if (!session_id()) {
        session_start();
    }
    //Added this method to detect session timeout of no more than hours now if set
    if (isset($_SESSION['LAST_ACTIVITY']) && time() - $_SESSION['LAST_ACTIVITY'] > $sessionTimeoutMax) {
        $log->debug("Session timed out Username: "******"You have been logged out due to inactivity. Please login.";
        session_unset();
        session_destroy();
        if (!session_id()) {
            session_start();
        }
        $_SESSION['forwardingUrl'] = urldecode($fullUrl);
        header("location: " . $site_prefix . "login.php?error=" . $errorMsg);
        exit;
    }
    if (!isset($_SESSION['authenticated'])) {
        $log->debug("user is not authenticated for page: " . urldecode($fullUrl));
        $indexPage = "index.php";
        $phpSuffix = "php";
        if (!strpos(urldecode($fullUrl), $phpSuffix) || strpos(urldecode($fullUrl), $indexPage)) {
            header("location: " . $site_prefix . "login.php");
            exit;
        } else {
            $_SESSION['forwardingUrl'] = urldecode($fullUrl);
            $errorMsg = "User must be logged in to access the site";
            header("location: " . $site_prefix . "login.php?error=" . $errorMsg);
            exit;
        }
    }
    //Test if user has licensed ON-SPOT plugin on user record. If not redirect the user to error page
    //Note this validation was moved below authentication check
    validatePlugin($_SESSION['userName'], $_SESSION['installedPlugins'], $pluginToValidate);
    if (empty($_SESSION['accessLevel'])) {
        $log->debug("validateUser() - user access level is set to null/empty send that user to error page");
        $errorMessage = "You do not have the necessary access rights in " . strtoupper($siteSection);
        $messageTitle = "Access Denied";
        processError($errorMessage, "N/A", "user_validate.php", "N/A", $messageTitle);
    } else {
        if ($siteSection == "View") {
            $log->debug("Validate user can View or edit spot viewer");
            //this test is specific to OnSpot/OnSpotView for viewing the page
            //TODO we need to figure out the privs for Request side of the site. For now we skip this as can edit method controls this
            if (!canViewOrEdit($_SESSION['accessLevel'], $siteSection, $viewCheck)) {
                $log->debug("User does not have access privilege to the site section: " . $siteSection . " Username: "******"You do not have the necessary access rights in " . strtoupper($siteSection);
                $messageTitle = "Access Denied";
                processError($errorMessage, "N/A", "user_validate.php", "N/A", $messageTitle);
            }
        }
    }
    //Update session timer for each page visited. Once the session is dormant for 2 hours the test for session
    //session timeout is caught by timeout test ahead of this reset method
    resetSessionTimeout();
    $log->debug("User is fully validated so redirect to page URL: " . urldecode($fullUrl));
}
Exemplo n.º 5
0
    $pkId = $_POST['pk'];
    $log->debug("WE have the pkId: " . $pkId);
} else {
    $log->error("No PK provided to get conatiner URL");
    $status = "error";
    die;
}
$metaFind = $fmOrderDB->newFindCommand('[WEB] Project Meta Fields');
$metaFind->addFindCriterion('__pk_ID', '==' . $pkId);
$metaResults = $metaFind->execute();
if (FileMaker::isError($metaResults)) {
    $errorTitle = "Failed To Upload File";
    $error = "Meta Search Results Error: " . $metaResults->getMessage() . " " . $metaResults - getCode();
    $log->error($error);
    $status = "error";
    processError("Failed in get conatiner URL: " . $originalName, $metaResults->getMessage(), "imageUploader.php", $pkId, $errorTitle);
    exit;
}
$metaRelatedRecords = $metaResults->getRecords();
$metaRecord = $metaRelatedRecords[0];
$containerUrl = $metaRecord->getField('Answer_Container_Data_r');
$originalFileName = $metaRecord->getField('Upload_Filename_Original_t');
$containerStatus = "";
if (empty($containerUrl)) {
    $containerStatus = "empty";
} else {
    $containerStatus = "have_url";
}
returnJsonToAjax($status, $containerStatus, $containerUrl, $originalFileName);
//function to return a json array for calling JQuery call
function returnJsonToAjax($status, $containerStatus, $urlToUse, $fileName)
Exemplo n.º 6
0
        $deliverableResults = $DeliverableFind->execute();
        //This is the control if no deliverable records exist the skip the deliverable save operation
        $processDeliverable = true;
        if (FileMaker::isError($deliverableResults)) {
            $errorTitle = "FileMaker Error";
            $log->error("Failure to open " . $deliverableLayout . " " . $deliverableResults->getMessage() . " " . $deliverableResults->getCode());
            processError($deliverableResults->getMessage(), $deliverableResults->getErrorString(), "processRequest.php", $pkId, $errorTitle);
            exit;
        } else {
            //Get all records after error test
            $projectReqDelRelatedSets = $deliverableResults->getRecords();
        }
        $deliveriableRecord = $projectReqDelRelatedSets[0];
        $deliveriableRecId = $deliveriableRecord->getRecordId();
        $log->debug('We have the recordId: ' . $deliveriableRecId);
        $deleteRecord = $fmOrderDB->newDeleteCommand($deliverableLayout, $deliveriableRecId);
        $deleteResults = $deleteRecord->execute();
        if (FileMaker::isError($deleteResults)) {
            $errorTitle = "FileMNaker Error";
            $log->error("Failed to delete Deliverable PK: " . $pkToDelete . " RecordId: " . $deliveriableRecId . " Error Message: " . $deleteResults->getMessage());
            processError($deleteResults->getMessage(), $deleteResults->getErrorString(), "processRequest.php", $pkToDelete, $errorTitle);
            exit;
        }
        $log->debug("Successfully deleted Deliveriable Record PK: " . $pkToDelete . " RecId: " . $deliveriableRecId);
        echo "success";
    } else {
        //TODO This should go to a clean Error page like error404.php
        $log->debug("This is a error condition and the script or processing never happened");
        header('Location: ' . $request_site_prefix . 'request.php?pkId=' . urlencode($pkId) . '&message=Error');
    }
}
Exemplo n.º 7
0
    $log->error("Deliverable Record Set (Save) Error: " . $deliverableRecordResults->getMessage() . " " . $deliverableRecordResults->getCode());
    processError($deliverableRecordResults->getMessage(), $deliverableRecordResults->getErrorString(), "deliverableService.php", $deliverablePkId, $errorTitle);
    exit;
}
//Process the Deliverable Tags ahead of the meta data
processDeliverableTags($_POST, $deliverablePkId, $fmOrderDB);
//Process Meta records for this deliverable and project
if (isset($metaRelatedRecords)) {
    foreach ($metaRelatedRecords as $meta) {
        $fieldType = $meta->getField($metaFieldType);
        $metaPkId = $meta->getField('__pk_ID');
        if ($fieldType != 'Image' && $fieldType != 'File') {
            if (!empty($_POST[$metaPkId])) {
                $meta->setField($metaFieldName, $_POST[$metaPkId]);
                $metaResults = $meta->commit();
                if (FileMaker::isError($metaResults)) {
                    $log->error("deliverableService.php - Meta Record Set Error: " . $metaResults->getMessage() . " " . $metaResults->getCode());
                    $errorTitle = "FileMaker Error";
                    processError($metaResults->getMessage(), $metaResults->getErrorString(), "deliverableService.php", $deliverablePkId, $errorTitle);
                    exit;
                }
            }
        }
    }
}
$message = "Success";
header('Cache-Control: no-cache, no-store, max-age=0, must-revalidate');
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
// Date in the past
header('Pragma: no-cache');
header('Location: ' . $request_site_prefix . 'deliverableview.php?pkId=' . urlencode($deliverablePkId) . '&itemId=' . $itemId . '&message=' . $message);
Exemplo n.º 8
0
<?php

/**
 * Created by IntelliJ IDEA.
 * User: Bill
 * Date: 1/8/2015
 * Time: 1:23 PM
 */
include_once dirname(__DIR__) . DIRECTORY_SEPARATOR . "request-config.php";
include_once $fmfiles . "order.db.php";
include_once $errors . 'errorProcessing.php';
$typePkId = urldecode($_GET['pkId']);
$newProjectType = $fmOrderDB->newPerformScriptCommand('[WEB] Project Request Types', 'NewProjectRequest(RequestType_pk_ID)', $typePkId);
$newProjectTypeResults = $newProjectType->execute();
if (FileMaker::isError($newProjectTypeResults)) {
    $errorTitle = "FileMaker Error";
    $log->error("Failure to open " . $deliverableView . " " . $newProjectTypeResults->getMessage() . " " . $newProjectTypeResults->getCode());
    processError($newProjectTypeResults->getMessage(), $newProjectTypeResults->getErrorString(), "getNewPackageType.php", $typePkId, $errorTitle);
}
$typeRecord = $newProjectTypeResults->getFirstRecord();
$projectId = $typeRecord->getField('__pk_ID');
header('Cache-Control: no-cache, no-store, max-age=0, must-revalidate');
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
// Date in the past
header('Pragma: no-cache');
header('Location: ' . $site_prefix . 'onrequest/request.php?pkId=' . urlencode($projectId));
?>

Exemplo n.º 9
0
function pushImageToFM($originalName, $tempName, $pkId)
{
    global $log, $fmOrderDB;
    $metaFind = $fmOrderDB->newFindCommand('[WEB] Project Meta Fields');
    $metaFind->addFindCriterion('__pk_ID', '==' . $pkId);
    $metaResults = $metaFind->execute();
    if (FileMaker::isError($metaResults)) {
        $errorTitle = "Failed To Upload File";
        $error = "Meta Search Results Error: " . $metaResults->getMessage() . " " . $metaResults - getCode();
        $log->error($error);
        processError("Failed To upload File: " . $originalName, $metaResults->getMessage(), "imageUploader.php", $pkId, $errorTitle);
        exit;
    }
    $metaRelatedRecords = $metaResults->getRecords();
    $metaRecord = $metaRelatedRecords[0];
    $metaRecord->setField('Upload_Filename_Original_t', $originalName);
    $metaRecord->setField("Upload_Filename_Temp_t", $tempName);
    //set container field within record to empty initially so FM script can upload the image or file to container
    $metaRecord->setField("Answer_Container_Data_r", "");
    $result = $metaRecord->commit();
    if (FileMaker::isError($result)) {
        $errorTitle = "Failed To Upload File";
        $error = "Error Saving Record " . $pkId . " Error Message: " . $result->getMessage() . " Error Code " . $result->getCode();
        $log->error($error);
        processError("Failed To upload File: " . $originalName, $result->getMessage(), "imageUploader.php", $pkId, $errorTitle);
        exit;
    }
    $log->debug("Completed writing original and PK filenames to FileMaker record");
}
Exemplo n.º 10
0
function processDeliverableTags($post, $deliverablePkId, $orderDBHandle)
{
    global $log;
    //set this to make sure the tag processor does not fail
    $tagRecords = array();
    $tagsLayout = "[WEB] Project Deliverable Tags";
    $tagsFind = $orderDBHandle->newFindCommand($tagsLayout);
    $tagsFind->addFindCriterion("_fk_Deliverable_pk_ID", '==' . $deliverablePkId);
    $tagsResults = $tagsFind->execute();
    if (FileMaker::isError($tagsResults)) {
        if ($tagsResults->getMessage() == "No records match the request") {
            $log->debug("No Tag records found");
        } else {
            $errorTitle = "FileMaker Error";
            $log->error("Failure to open (processDeliverableTags() ) " . $tagsLayout . " " . $tagsResults->getMessage() . " " . $tagsResults->getCode());
            processError($tagsResults->getMessage(), $tagsResults->getErrorString(), "tagProcessing.php", $deliverablePkId, $errorTitle);
            exit;
        }
    } else {
        $tagRecords = $tagsResults->getRecords();
    }
    //Get __pk_ID from FM tag layout feed PK to POST array to get values
    foreach ($tagRecords as $tagRecord) {
        $tagPk = $tagRecord->getField('__pk_ID');
        if (isset($post[$tagPk])) {
            if ($post[$tagPk] == 'delete') {
                $deleteResult = $tagRecord->delete();
                //This is a FileMaker delete of a record
                if (FileMaker::isError($deleteResult)) {
                    $errorTitle = "FileMaker Error";
                    $log->error("Failure to delete tag (processDeliverableTags() ) " . $tagsLayout . " " . $deleteResult->getMessage() . " " . $deleteResult->getCode());
                    processError($deleteResult->getMessage(), $deleteResult->getErrorString(), "tagProcessing.php", $tagPk, $errorTitle);
                    exit;
                }
            }
        } else {
            $tagRowArray = getTagInfoFromPost($post, $tagPk);
            if (isset($tagRowArray)) {
                $tagRecord->setField('PromoCode_Descriptor_t', getTagCodeValue($tagRowArray[0]));
                $tagRecord->setField('PromoCode_3_TagVersion_t', getTagCodeValue($tagRowArray[1]));
                $tagRecord->setField('Tag_Version_Description_t', stripHtmlWithSpaces($tagRowArray[2]));
                $tagRecord->setField('House_Number_t', $tagRowArray[3]);
            }
            $tagCommit = $tagRecord->commit();
            if (FileMaker::isError($tagCommit)) {
                $errorTitle = "FileMaker Error";
                $log->error("Failure to save tag (processDeliverableTags() ) " . $tagsLayout . " " . $tagCommit->getMessage() . " " . $tagCommit->getCode());
                processError($tagCommit->getMessage(), $tagCommit->getErrorString(), "tagProcessing.php", "N/A", $errorTitle);
                exit;
            }
        }
    }
    $prefix = "noTagPkId";
    $search = $prefix . "_*";
    //Do not forget the wildcard star!!!!!! so anything noTagPkId
    $tagDescriptor = "td";
    $tagVersion = "tv";
    $tagDescription = "tt";
    $tagHouse = "th";
    $us = "_";
    $allFieldsProcessed = 1;
    $maxItemsToProcess = 4;
    echo PHP_EOL . "Now run search for our No Pk Id" . PHP_EOL;
    foreach (array_key_exists_wildcard($post, $search) as $key => $value) {
        $index = getTagIndex($value);
        if (isset($post[$value]) && !empty($post[$value]) && getKetType($value) == $tagDescriptor) {
            $noTagPkWriteArray[0] = getTagCodeValue($post[$prefix . $us . $tagDescriptor . $us . $index]);
        }
        if (isset($post[$value]) && !empty($post[$value]) && getKetType($value) == $tagVersion) {
            $noTagPkWriteArray[1] = getTagCodeValue($post[$prefix . $us . $tagVersion . $us . $index]);
        }
        if (isset($post[$value]) && !empty($post[$value]) && getKetType($value) == $tagDescription) {
            $noTagPkWriteArray[2] = $post[$prefix . $us . $tagDescription . $us . $index];
        }
        if (isset($post[$value]) && !empty($post[$value]) && getKetType($value) == $tagHouse) {
            $noTagPkWriteArray[3] = $post[$prefix . $us . $tagHouse . $us . $index];
        }
        $allFieldsProcessed++;
        //Now we have values or not written to NoPkId tag values if we do the write them to FM otherwise skip
        if (isset($noTagPkWriteArray[0]) || isset($noTagPkWriteArray[1]) || isset($noTagPkWriteArray[2]) || isset($noTagPkWriteArray[3])) {
            if ($allFieldsProcessed > $maxItemsToProcess) {
                $newTagRecord = $orderDBHandle->createRecord($tagsLayout);
                $newTagRecord->setField("_fk_Deliverable_pk_ID", $deliverablePkId);
                if (isset($noTagPkWriteArray[0]) && !empty($noTagPkWriteArray[0])) {
                    $newTagRecord->setField('PromoCode_Descriptor_t', $noTagPkWriteArray[0]);
                }
                if (isset($noTagPkWriteArray[1]) && !empty($noTagPkWriteArray[1])) {
                    $newTagRecord->setField('PromoCode_3_TagVersion_t', $noTagPkWriteArray[1]);
                }
                if (isset($noTagPkWriteArray[2]) && !empty($noTagPkWriteArray[2])) {
                    $newTagRecord->setField('Tag_Version_Description_t', stripHtmlWithSpaces($noTagPkWriteArray[2]));
                }
                if (isset($noTagPkWriteArray[3]) && !empty($noTagPkWriteArray[3])) {
                    $newTagRecord->setField('House_Number_t', $noTagPkWriteArray[3]);
                }
                $addTagResults = $newTagRecord->commit();
                if (FileMaker::isError($addTagResults)) {
                    $errorTitle = "FileMaker Error";
                    $log->error("Failure to save tag (processDeliverableTags() ) " . $tagsLayout . " " . $addTagResults->getMessage() . " " . $addTagResults->getCode());
                    processError($addTagResults->getMessage(), $addTagResults->getErrorString(), "tagProcessing.php", "N/A", $errorTitle);
                    exit;
                }
                $allFieldsProcessed = 1;
                $noTagPkWriteArray = array();
            }
        }
    }
}
Exemplo n.º 11
0
<?php

/**
 * Created by IntelliJ IDEA.
 * User: Bill
 * Date: 11/3/2014
 * Time: 3:51 PM
 * TODO: add comments to describe the file functionality of this php file
 */
include_once dirname(__DIR__) . DIRECTORY_SEPARATOR . "request-config.php";
include_once $fmfiles . 'order.db.php';
include_once $errors . 'errorProcessing.php';
$pageUrl = urlencode($port . "{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}");
$log->debug("Start get I Table records");
$findLabels = $fmOrderDB->newFindCommand("[WEB] i_Table");
$results = $findLabels->execute();
if (FileMaker::IsError($results)) {
    $log->error($results->getMessage(), $results->getErrorString(), $pageUrl, $requestPkId, $site_prefix);
    $errorTitle = "FileMaker Error";
    processError($results->getMessage(), $results->getErrorString(), $pageUrl, "N/A", $errorTitle);
    exit;
}
$labels = $results->getRecords();
$labelRecord = $labels[0];
$log->debug("End -- Now have I Table records");
Exemplo n.º 12
0
    /** Check for errors and if so send to error processing and report to user */
    if (FileMaker::isError($saveFinds)) {
        $errorTitle = "FileMaker Error";
        $log->error($saveFinds->getMessage(), $saveFinds->getErrorString(), $pageUrl, $pkId, $site_prefix);
        processError($saveFinds->getMessage(), $saveFinds->getErrorString(), $pageUrl, $pkId, $errorTitle);
        exit;
    }
    /** Now pull all records of find command for Requests (Parent of Meta data) and pull the first record of the array */
    $saveRequests = $saveFinds->getRecords();
    $saveRecord = $saveRequests[0];
    $saveRecord->setField('Programming_Type_t', $requestDivision);
    $saveRequest = $saveRecord->commit();
    if (FileMaker::isError($saveRequest)) {
        $errorTitle = "FileMaker Error";
        $log->error("Failed save Programming type to request", $saveRequest->getMessage(), $saveRequest->getErrorString(), $pageUrl, $requestPkId, $site_prefix);
        processError($saveRequest->getMessage(), $saveRequest->getErrorString(), $pageUrl, $requestPkId, $errorTitle);
        exit;
    }
    $log->debug("Programming type was empty is now set to: " . $requestDivision . " For PK: " . $requestPkId);
}
//Now load session data for show codes
if (!isset($_SESSION[$showCodesSessionIndex])) {
    $showCodeItems = loadShowCodeSessionData($fmOrderDB, $allProgrammingTypes, $requestPkId, $pageUrl);
} else {
    $log->debug("Use Session to load showCodeItems array");
    $showCodeItems = $_SESSION[$showCodesSessionIndex];
}
//End Code change to use SESSION Programming_Type_t if no value stored on record
$log->debug("End Show Code list from FM or just Session");
//The software is no longer attempting to pull Episode number list 02/12/2015
$requestorEpisodeNumberName = "Show_EpisodeNumber_t";
Exemplo n.º 13
0
#!/usr/bin/env php
<?php 
// if [ ! -e "release" ]; then
//      mkdir release
// fi
//
// zip -rqX ./release/CodeLapse.zip cl/ -x cl/test/\*
// zip -rqX ./release/CodeLapse_document.zip api_documents/
include dirname(__FILE__) . '/../cl/bs.php';
$excludePatterns = array('/\\/\\.gitkeep$/', '/\\/.DS_Store$/', '/\\/(test|tests)\\/.*$/', '/phpunit.*\\.xml$/', '/composer\\..*$/', '/\\/\\..*$/');
// Make `release` dir
!file_exists('./release') and mkdir('release');
// Make zip
$zip = new ZipArchive();
$result = $zip->open('./release/_CodeLapse.zip', ZipArchive::CREATE);
$result !== true and processError($result);
// List up package files
$rdi = new RecursiveDirectoryIterator('cl/', FilesystemIterator::SKIP_DOTS | FilesystemIterator::KEY_AS_PATHNAME | FilesystemIterator::CURRENT_AS_FILEINFO);
$itr = new RecursiveIteratorIterator($rdi);
// Exclude exclusion files
$entries = Arr::wrapWithKey(iterator_to_array($itr))->exclude(function ($info, $path) use($excludePatterns) {
    return Arr::wrap($excludePatterns)->reduce(function ($nomatch, $pattern) use($path) {
        return $nomatch or preg_match($pattern, $path);
    }, false)->get();
})->keys()->each(function ($entry) use($zip) {
    $zip->addFile($entry);
})->get();
// End
echo "End.\n";
$zip->close();
// Error processor
Exemplo n.º 14
0
}
//Process the note information only as a user pushed the Add button/Link
//Since the calling page is now a dual form this code accepts a click event occurred so the data should be
// persisted to FileMaker for each section
if (isset($_POST['userNote'])) {
    $log->debug("userNote is set and running");
    if (isset($_POST['notes'])) {
        $notes = $_POST['notes'];
    }
    //If the notes record has data then create the record in the layout (No empty record need to be created)
    if (isset($notes) && !empty($notes)) {
        $newNoteRecord = $fmWorkDB->createRecord($userNotesLayout);
        $newNoteRecord->setField('Note_Type_t', $noteType);
        $newNoteRecord->setField('_fk_LinkedObject_ID', $pkId);
        $newNoteRecord->setField('Note_Text_t', $notes);
        $newNoteRecord->setField('z_RecCreatedBy', $_SESSION['userName']);
        $addNote = $newNoteRecord->commit();
        if (FileMaker::isError($addNote)) {
            $errorTitle = "FileMaker Error";
            $messageType = "d";
            $log->error("Save user note Error: " . $addNote->getMessage() . " User: "******"A serious error has occurred and you should immediately contact Thought-Development Support for assistance.";
            processError($addNote->getMessage(), $addNote->getErrorString(), "spotViewerResponse.php", $pkId, $errorTitle);
            exit;
        }
        $log->debug("Added record to database with user name: " . $_SESSION['userName']);
    }
}
//redirect to spot viewer page for user to see note added or approver change
header("Location: spotedit.php?pkId=" . urlencode($pkId));
exit;
Exemplo n.º 15
0
     $log->info("Secondary search for user records for user: "******"z_RecCreatedBy", "==" . $_SESSION['userName']);
     $userHasNotes = true;
 }
 $note->addSortRule($sortFieldOne, 1, FILEMAKER_SORT_DESCEND);
 $note->addSortRule($sortFieldTwo, 2, FILEMAKER_SORT_DESCEND);
 $noteRecords = $note->execute();
 $processNotes = false;
 //Check for errors and no records found is not a true error as it is possible that no comments have been made
 if (FileMaker::isError($noteRecords)) {
     if ($noteRecords->getCode() != $noRecordsFound) {
         $errorTitle = "FileMaker Error";
         $messageType = "d";
         $log->error("Serous  Note Error: " . $noteRecords->getMessage() . " User " . $_SESSION['userName']);
         $message = "A serious error has occurred and you should immediately contact Thought-Development Support for assistance.";
         processError($noteRecords->getMessage(), $noteRecords->getErrorString(), $pageUrl, $pkId, $errorTitle);
         exit;
     } elseif ($noteRecords->getCode() == $noRecordsFound) {
         $processNotes = false;
         $log->debug("Spot Viewer Notes No user records found using pk: " . $pkId . " User: "******"titleWithVideoView.php";
 //put the if switch here as to which file to include
Exemplo n.º 16
0
<?php

/**
 * Created by IntelliJ IDEA.
 * User: Bill
 * Date: 12/15/2014
 * Time: 9:25 AM
 */
include_once dirname(__DIR__) . DIRECTORY_SEPARATOR . "request-config.php";
include_once $fmfiles . 'order.db.php';
include_once $errors . 'errorProcessing.php';
$pageUrl = urlencode($port . "{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}");
$sortField = "Request_Created_Date_d";
$requestListFind = $fmOrderDB->newFindCommand('[WEB] Project Request List');
//Added new sort order for Project List on Created Date
$requestListFind->addSortRule($sortField, 1, FILEMAKER_SORT_DESCEND);
$requestListFinds = $requestListFind->execute();
if (FileMaker::isError($requestListFinds)) {
    if ($requestListFinds->getCode() == $noRecordsFound) {
        $requestList = array();
        $log->debug("Request list is empty no records found. Now display empty Request table view");
    } else {
        $log->error($saveFinds->getMessage(), $saveFinds->getErrorString(), $pageUrl, "NA", $site_prefix);
        processError($saveFinds->getMessage(), $saveFinds->getErrorString(), $pageUrl, "NA", $errorTitle);
        exit;
    }
} else {
    $requestList = $requestListFinds->getRecords();
}
Exemplo n.º 17
0
    $tagsArray = $_SESSION[$tagsSessionIndex];
}
//Pull tags set in FM by Deliverable PK ID
$tagsLayout = "[WEB] Project Deliverable Tags";
$tagsFind = $fmOrderDB->newFindCommand($tagsLayout);
$log->debug("Add search criteria Deliverable PKID: " . $deliverablePkId);
$tagsFind->addFindCriterion("_fk_Deliverable_pk_ID", '==' . $deliverablePkId);
$tagsResults = $tagsFind->execute();
if (FileMaker::isError($tagsResults)) {
    if ($tagsResults->getCode() == $noRecordsFound) {
        $log->debug("No matching Tag records found found for deliveriable PKID: " . $deliverablePkId);
        $tagRecords = array();
    } else {
        $log->error("Tag Search Error Message: " . $tagsResults->getMessage() . " Error String: " . $tagsResults->getErrorString() . " Page URL: " . $pageUrl . " PK ID: " . $deliverablePkId);
        $errorTitle = "FileMaker Error";
        processError($tagsResults->getMessage(), $tagsResults->getErrorString(), $pageUrl, $deliverablePkId, $errorTitle);
        exit;
    }
} else {
    $tagRecords = $tagsResults->getRecords();
    $tagRecordCount = $tagsResults->getFoundSetCount();
    $log->debug("End find tags command record count: " . $tagRecordCount);
}
//Build dropdown of the version list of Tags for given Programming_type_t
$promoCodeVersionValueList = array();
$promoCodeVersionDisplayList = array();
$tagsForThisDivision = $tagsArray[$requestDivision];
if (!empty($tagsForThisDivision)) {
    foreach ($tagsForThisDivision as $code => $value) {
        array_push($promoCodeVersionValueList, convertTagForValueField($code . " " . $value));
        array_push($promoCodeVersionDisplayList, convertTagDisplay($code . " " . $value));
Exemplo n.º 18
-1
function pushDocumentDataToFM($original, $temp, $pkId)
{
    global $fmOrderDB, $log;
    /* TODO need to investigate why getRelatedRecords() Stopped Working */
    $metaFind = $fmOrderDB->newFindCommand('[WEB] Project Meta Fields');
    $metaFind->addFindCriterion('__pk_ID', '==' . $pkId);
    $metaResults = $metaFind->execute();
    if (FileMaker::isError($metaResults)) {
        $errorTitle = "FileMaker Error";
        $log->error("pushDocumentDataToFM - Failure to open " . $metaResults . " " . $metaResults->getMessage() . " " . $metaResults->getCode());
        processError($metaResults->getMessage(), $metaResults->getErrorString(), "deliverableService.php", $pkId, $errorTitle);
        exit;
    }
    $metaRelatedRecords = $metaResults->getRecords();
    $metaRecord = $metaRelatedRecords[0];
    $metaRecord->setField('Upload_Filename_Original_t', $original);
    $metaRecord->setField("Upload_Filename_Temp_t", $temp);
    $result = $metaRecord->commit();
    if (FileMaker::isError($result)) {
        $errorTitle = "FileMaker Error";
        $log->error("pushDocumentDataToFM - Failure to open " . $metaResults . " " . $result->getMessage() . " " . $result->getCode());
        processError($result->getMessage(), $result->getErrorString(), "deliverableService.php", $pkId, $errorTitle);
        exit;
    }
}
Exemplo n.º 19
-1
    $log->debug("printPage.php - set exe location and options");
    $snappy = new Pdf('C://"Program Files/"/wkhtmltopdf/bin/wkhtmltopdf.exe');
    $snappy->setOption('page-size', 'A3');
    $snappy->setOption('disable-external-links', true);
} catch (Exception $e) {
    $log->error("printPage.php - New PDF Class Exception: " . $e->getMessage());
}
if (isset($_POST['url'])) {
    $urlIn = urldecode($_POST['url']);
    $url = setPrintEncryptionUrl($urlIn);
    $log->debug("Use Post to get URL: " . $url);
    header('Content-Type: application/pdf');
    header('Cache-Control: public, must-revalidate, max-age=0');
    // HTTP/1.1
    header('Pragma: public');
    header('Expires: Sat, 26 Jul 1997 05:00:00 GMT');
    // Date in the past
    header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
    header('Content-Type: application/pdf');
    header('Content-Disposition: inline; filename="print_page.pdf"');
    try {
        echo $snappy->getOutput($url);
    } catch (Exception $e) {
        $log->error("Exception thrown PDF Generation error: " . $e->getMessage());
    }
} else {
    $errorTitle = "Print Page Error";
    $log->error("Error Print Operation", "No URL sent from page to print", $pageUrl, null, null);
    processError("Error Print Operation", "Error Print Operation", $pageUrl, null, null, $errorTitle);
    exit;
}