<?php require 'functions.php'; write_header(); if (!isset($_REQUEST['dir']) || $_REQUEST['dir'] == "" || substr($_REQUEST['dir'], 0, 1) == "." || !is_dir(__DIR__ . '/' . PHOTOS_PATH . $_REQUEST['dir'])) { $_REQUEST['dir'] = ""; } echo '<div class=gallery>'; if ($_REQUEST['dir'] !== "") { show_back(PHOTOS_PATH . $_REQUEST['dir']); } list_dirs(get_dirs($_REQUEST['dir'])); list_photos(get_images(PHOTOS_PATH . $_REQUEST['dir'])); echo '</div>';
//end getMatrixFolderId() // hash table that contains the name of the folder and its corresponding matrix asset id // if the matrix asset id is empty (equals to zero) means that the folder doesnt exist yet $matrix_ids = array(); if (empty($matrix_root_assetid)) { $import_dirs = list_dirs($import_home_dir, FALSE); } else { $import_dirs = array(); // get the list of all the subfolders $import_dirs = list_dirs($import_home_dir, TRUE, array(), TRUE); // initialise the matrix_ids foreach ($import_dirs as $value) { $matrix_ids[$value] = 0; } // add the import_home_dir to the $import_dirs array and matrix_ids $import_dirs = array_merge(array($import_home_dir), list_dirs($import_home_dir, TRUE, array(), TRUE)); $matrix_ids[$import_home_dir] = $matrix_root_assetid; } foreach ($import_dirs as $import_dir) { $import_path = $import_home_dir . '/' . $import_dir; if (empty($matrix_root_assetid)) { $parent_asset = $GLOBALS['SQ_SYSTEM']->am->getAsset(trim($import_dir)); } else { $parent_asset = $GLOBALS['SQ_SYSTEM']->am->getAsset(getMatrixFolderId(trim($import_dir), $matrix_ids)); // overwrite the import path because we are using fullpath $import_path = $import_dir; } if (is_null($parent_asset)) { trigger_error("New parent asset #{$parent_assetid} does not exist\n", E_USER_ERROR); } $import_link = array('asset' => $parent_asset, 'link_type' => SQ_LINK_TYPE_1);
//end if require_once $SYSTEM_ROOT . '/core/include/init.inc'; if (ini_get('memory_limit') != '-1') { ini_set('memory_limit', '-1'); } $count = 0; $count_rm = 0; $count_2 = 0; $count_rm_2 = 0; $form_assetids = $GLOBALS['SQ_SYSTEM']->am->getTypeAssetIds('form', FALSE); foreach ($form_assetids as $assetid) { $asset = $GLOBALS['SQ_SYSTEM']->am->getAsset($assetid); $complete_link = $GLOBALS['SQ_SYSTEM']->am->getLink($assetid, SQ_LINK_TYPE_2, 'folder', TRUE, 'submissions_folder'); $path = $asset->data_path; $path .= '/incomplete_attachments'; $files = list_dirs($path); foreach ($files as $file) { if (strpos($file, 's') === 0 && assert_valid_assetid(substr($file, 1), '', TRUE, FALSE)) { // This is an incomplete submission, so check if the submission is still valid $incomplete_submission_assetid = substr($file, 1); $incomplete_submission = $GLOBALS['SQ_SYSTEM']->am->getAsset($incomplete_submission_assetid, '', TRUE); if (is_null($incomplete_submission)) { // Report only echo 'Form #' . $assetid . ' still has some incomplete attachment directories for non-existent Submission #' . $incomplete_submission_assetid . '.'; $count++; if ($CORRECT) { // Remove the dir, not needed echo ' Removing.'; delete_directory($path . '/' . $file); $count_rm++; echo ' Done.';