function validID() { $engine = EngineAPI::singleton(); if (!isset($engine->cleanGet['MYSQL']['formID']) || is_empty($engine->cleanGet['MYSQL']['formID']) || !validate::integer($engine->cleanGet['MYSQL']['formID'])) { if (objects::validID($engine->cleanGet['MYSQL']['objectID'])) { $object = objects::get($engine->cleanGet['MYSQL']['objectID']); if ($object === FALSE) { return FALSE; } http::setGet('formID', $object['formID']); } else { return FALSE; } } return TRUE; }
$selectedProjects = NULL; $parentObject = NULL; $permissions = TRUE; try { $error = FALSE; if (objects::validID() === FALSE) { throw new Exception("ObjectID Provided is invalid."); } if (forms::validID() === FALSE) { throw new Exception("No Form ID Provided."); } if (mfcsPerms::isEditor($engine->cleanGet['MYSQL']['formID']) === FALSE) { $permissions = FALSE; throw new Exception("Permission Denied to view objects created with this form."); } if (isset($engine->cleanGet['MYSQL']['parentID']) && objects::validID(TRUE, $engine->cleanGet['MYSQL']['parentID']) === FALSE) { throw new Exception("ParentID Provided is invalid."); } // if an object ID is provided make sure the object is from this form if (!isnull($engine->cleanGet['MYSQL']['objectID']) && !objects::checkObjectInForm($engine->cleanGet['MYSQL']['formID'], $engine->cleanGet['MYSQL']['objectID'])) { throw new Exception("Object not from this form."); } if (($form = forms::get($engine->cleanGet['MYSQL']['formID'])) === FALSE) { throw new Exception("Error retrieving form."); } if (forms::isProductionReady($engine->cleanGet['MYSQL']['formID']) === FALSE) { $permissions = FALSE; throw new Exception("Form is not production ready."); } if (forms::isMetadataForm($engine->cleanGet['MYSQL']['formID'])) { throw new Exception("Metadata form provided (Object forms only).");
ob_end_clean(); recurseInsert("acl.php", "php"); $permissions = TRUE; $type = "zip"; try { $error = FALSE; if (!isset($engine->cleanGet['MYSQL']['objectID'])) { throw new Exception("No ObjectID Provided."); } // If we have an objectID and no formID, lookup the formID from the object and set it back into the GET if (isset($engine->cleanGet['MYSQL']['objectID']) and !isset($engine->cleanGet['MYSQL']['formID'])) { $object = objects::get($engine->cleanGet['MYSQL']['objectID']); http::setGet('formID', $object['formID']); } // Object ID Validation if (objects::validID(TRUE, $engine->cleanGet['MYSQL']['objectID']) === FALSE) { throw new Exception("ObjectID Provided is invalid."); } if (mfcsPerms::isViewer($engine->cleanGet['MYSQL']['formID']) === FALSE) { $permissions = FALSE; throw new Exception("Permission Denied to view objects created with this form."); } if (isset($engine->cleanGet['MYSQL']['type']) && $engine->cleanGet['MYSQL']['type'] == "tar") { $type = "tar"; } if (is_array($object['data']['digitalFiles'])) { $files = array(); foreach ($object['data']['digitalFiles']['files']['archive'] as $file) { $files[] = sprintf("%s", $file['name']); } $files = implode(" ", $files);
<?php include "../header.php"; if (isset($engine->cleanGet['HTML']['ajax']) && strtolower($engine->cleanGet['HTML']['ajax']) == "true") { $ajax = TRUE; } else { $ajax = FALSE; } $permissions = TRUE; try { if (objects::validID() === FALSE) { throw new Exception("ObjectID Provided is invalid."); } if (forms::validID() === FALSE) { throw new Exception("No Form ID Provided."); } if (mfcsPerms::isAdmin($engine->cleanGet['MYSQL']['formID']) === FALSE) { $permissions = FALSE; throw new Exception("Permission Denied to view objects created with this form."); } $form = forms::get($engine->cleanGet['MYSQL']['formID']); if ($form === FALSE) { throw new Exception("Error retrieving form."); } if (forms::isProductionReady($engine->cleanGet['MYSQL']['formID']) === FALSE) { $permissions = FALSE; throw new Exception("Form is not production ready."); } if (forms::isMetadataForm($engine->cleanGet['MYSQL']['formID']) === FALSE) { throw new Exception("Object form provided (Metadata forms only)."); }
public static function buildFilesPreview($objectID, $fieldName = NULL) { if (objects::validID(TRUE, $objectID) === FALSE) { return FALSE; } if (($object = objects::get($objectID, TRUE)) === FALSE) { return FALSE; } $output = ''; if (isset($fieldName)) { $field = forms::getField($object['formID'], $fieldName); $fields = array($field); } else { $fields = forms::getFields($object['formID']); } $fileLIs = array(); foreach ($fields as $field) { if ($field['type'] != 'file') { continue; } // If there's nothing uploaded for the field, no need to continue if (empty($object['data'][$field['name']])) { continue; } // Figure out some needed vars for later $fileDataArray = $object['data'][$field['name']]; $assetsID = $fileDataArray['uuid']; $fileLIs = array(); uasort($fileDataArray['files']['archive'], function ($a, $b) { return strnatcasecmp($a['name'], $b['name']); }); foreach ($fileDataArray['files']['archive'] as $fileID => $file) { $_filename = pathinfo($file['name']); $filename = $_filename['filename']; $links = array(); $links['Original'] = sprintf('%sincludes/fileViewer.php?objectID=%s&field=%s&fileID=%s&type=%s', localvars::get('siteRoot'), $objectID, $field['name'], $fileID, 'archive'); if (str2bool($field['convert'])) { $links['Converted'] = sprintf('%sincludes/fileViewer.php?objectID=%s&field=%s&fileID=%s&type=%s', localvars::get('siteRoot'), $objectID, $field['name'], $fileID, 'processed'); } if (str2bool($field['thumbnail'])) { $links['Thumbnail'] = sprintf('%sincludes/fileViewer.php?objectID=%s&field=%s&fileID=%s&type=%s', localvars::get('siteRoot'), $objectID, $field['name'], $fileID, 'thumbs'); } if (str2bool($field['ocr'])) { $links['OCR'] = sprintf('%sincludes/fileViewer.php?objectID=%s&field=%s&fileID=%s&type=%s', localvars::get('siteRoot'), $objectID, $field['name'], $fileID, 'ocr'); } if (str2bool($field['combine'])) { $links['Combined PDF'] = sprintf('%sincludes/fileViewer.php?objectID=%s&field=%s&type=%s', localvars::get('siteRoot'), $objectID, $field['name'], 'combinedPDF'); $links['Combined Thumbnail'] = sprintf('%sincludes/fileViewer.php?objectID=%s&field=%s&type=%s', localvars::get('siteRoot'), $objectID, $field['name'], 'combinedThumb'); } $previewLinks = array(); $downloadLinks = array(); foreach ($links as $linkLabel => $linkURL) { $previewLinks[] = sprintf('<li><a tabindex="-1" href="javascript:;" onclick="previewFile(this,\'%s\')">%s</a></li>', $linkURL, $linkLabel); $downloadLinks[] = sprintf('<li><a tabindex="-1" href="%s&download=1">%s</a></li>', $linkURL, $linkLabel); } // Build the preview dropdown HTML $previewDropdown = '<div class="btn-group">'; $previewDropdown .= ' <a class="btn dropdown-toggle" data-toggle="dropdown" href="#">'; $previewDropdown .= ' Preview <span class="caret"></span>'; $previewDropdown .= ' </a>'; $previewDropdown .= sprintf('<ul class="dropdown-menu">%s</ul>', implode('', $previewLinks)); $previewDropdown .= '</div>'; // Build the download dropbox HTML $downloadDropdown = '<div class="btn-group">'; $downloadDropdown .= ' <a class="btn dropdown-toggle" data-toggle="dropdown" href="#">'; $downloadDropdown .= ' Download <span class="caret"></span>'; $downloadDropdown .= ' </a>'; $downloadDropdown .= sprintf('<ul class="dropdown-menu">%s</ul>', implode('', $downloadLinks)); $downloadDropdown .= '</div>'; $fileLIs[] = sprintf('<li><div class="filename">%s</div><!-- TODO <button class="btn">Field Details</button> -->%s%s</li>', $file['name'], $previewDropdown, $downloadDropdown); } $output .= sprintf('<div class="filePreviewField"><header>%s</header><ul class="filePreviews">%s</ul></div>', $field['label'], implode('', $fileLIs)); } // Include the filePreview Modal, and the CSS and JavaScript links $output .= '<div id="filePreviewModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"><div class="modal-header"><button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button><h3></h3></div><div class="modal-body"><iframe class="filePreview"></iframe></div><div class="modal-footer"><a class="btn previewDownloadLink">Download File</a><a class="btn btn-primary" data-dismiss="modal" aria-hidden="true">Close</a></div></div>'; $output .= sprintf('<link href="%sincludes/css/filePreview.css" rel="stylesheet">', localvars::get('siteRoot')); $output .= sprintf('<script src="%sincludes/js/filePreview.js"></script>', localvars::get('siteRoot')); return $output; }
<?php include "../header.php"; $permissions = TRUE; try { // If we have an objectID and no formID, lookup the formID from the object and set it back into the GET if (isset($engine->cleanGet['MYSQL']['objectID']) and !isset($engine->cleanGet['MYSQL']['formID'])) { $object = objects::get($engine->cleanGet['MYSQL']['objectID']); http::setGet('formID', $object['formID']); } // Object ID Validation if (objects::validID(TRUE) === FALSE) { throw new Exception("ObjectID Provided is invalid."); } if (forms::validID() === FALSE) { throw new Exception("No Form ID Provided."); } if (mfcsPerms::isViewer($engine->cleanGet['MYSQL']['formID']) === FALSE) { $permissions = FALSE; throw new Exception("Permission Denied to view objects created with this form."); } if (!objects::checkObjectInForm($engine->cleanGet['MYSQL']['formID'], $engine->cleanGet['MYSQL']['objectID'])) { errorHandle::newError("Object not from this form.", errorHandle::DEBUG); throw new Exception("Object not from this form"); } log::insert("Data View: Object", $engine->cleanGet['MYSQL']['objectID'], $engine->cleanGet['MYSQL']['formID']); ////////// // Metadata Tab Stuff $form = forms::get($engine->cleanGet['MYSQL']['formID']); if ($form === FALSE) { throw new Exception("Error retrieving form.");